Skip to content

Fix use of _base_executable for Python 3.7.4 #1383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,14 +773,19 @@ def should_reinvoke(options):
# site.py.
#
# So, we check for sys._base_executable, but if it's not present and yet we
# hand __PYVENV_LAUNCHER__, we do what site.py would have done and get our
# have __PYVENV_LAUNCHER__, we do what site.py would have done and get our
# interpreter from GetModuleFileName(0). We also remove __PYVENV_LAUNCHER__
# from the environment, to avoid loops (actually, mainly because site.py
# does so, and my head hurts enough buy now that I just want to be safe!)

# In Python 3.7.4, the rules changed so that sys._base_executable is always
# set. So we now only return sys._base_executable if it's set *and does not
# match sys.executable* (we still have to check that it's set, as we need to
# support Python 3.7.3 and earlier).

# Phew.

if hasattr(sys, "_base_executable"):
if getattr(sys, "_base_executable", sys.executable) != sys.executable:
return sys._base_executable

if "__PYVENV_LAUNCHER__" in os.environ:
Expand Down