mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-35872 and bpo-35873: Clears __PYVENV_LAUNCHER__ variable (GH-11745)
After reading __PYVENV_LAUNCHER__ we now set sys._base_executable value for later use. Make the same changes for macOS to avoid extra platform checks.
This commit is contained in:
parent
2f6fae6e51
commit
a8474d025c
7 changed files with 33 additions and 23 deletions
|
@ -457,7 +457,14 @@ def venv(known_paths):
|
|||
|
||||
env = os.environ
|
||||
if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env:
|
||||
executable = os.environ['__PYVENV_LAUNCHER__']
|
||||
executable = sys._base_executable = os.environ['__PYVENV_LAUNCHER__']
|
||||
elif sys.platform == 'win32' and '__PYVENV_LAUNCHER__' in env:
|
||||
executable = sys.executable
|
||||
import _winapi
|
||||
sys._base_executable = _winapi.GetModuleFileName(0)
|
||||
# bpo-35873: Clear the environment variable to avoid it being
|
||||
# inherited by child processes.
|
||||
del os.environ['__PYVENV_LAUNCHER__']
|
||||
else:
|
||||
executable = sys.executable
|
||||
exe_dir, _ = os.path.split(os.path.abspath(executable))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue