-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
bpo-22490: Remove __PYVENV_LAUNCHER__ from environment during launch #9516
Conversation
… macOS This changeset removes the environment varialbe "__PYVENV_LAUNCHER__" during interpreter launch as it is only needed to communicate between the stub executable in framework installs and the actual interpreter. Leaving the environment variable present may lead to misbehaviour when launching other scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to know how to repro the original bug so I can demonstrate this actually fixes it. Here's what I think should be the repro:
The setup is that Unfortunately this does not fail for me (with a framework build from master installed). Would I have to do the install via brew? (I would have to learn about locally testing modified brew recipes, I suppose.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch LG from a code review POV.
@ronaldoussoren ping? |
…ld-system-reviewers,rstewart The __PYVENV_LAUNCHER__ is set on macos to indicate which python to use. Sadly, keeping this set confuses pip in virtualenvs. This corresponds to python/cpython#9516. Differential Revision: https://phabricator.services.mozilla.com/D59853
…ld-system-reviewers,rstewart The __PYVENV_LAUNCHER__ is set on macos to indicate which python to use. Sadly, keeping this set confuses pip in virtualenvs. This corresponds to python/cpython#9516. Differential Revision: https://phabricator.services.mozilla.com/D59853 --HG-- extra : moz-landing-system : lando
…ld-system-reviewers,rstewart The __PYVENV_LAUNCHER__ is set on macos to indicate which python to use. Sadly, keeping this set confuses pip in virtualenvs. This corresponds to python/cpython#9516. Differential Revision: https://phabricator.services.mozilla.com/D59853 UltraBlame original commit: ed91bca1f4a669454801390a1e5432fa2cd9561e
…ld-system-reviewers,rstewart The __PYVENV_LAUNCHER__ is set on macos to indicate which python to use. Sadly, keeping this set confuses pip in virtualenvs. This corresponds to python/cpython#9516. Differential Revision: https://phabricator.services.mozilla.com/D59853 UltraBlame original commit: ed91bca1f4a669454801390a1e5432fa2cd9561e
We think this is borking creation of a PyPy virtualenv using cpython host on macOS and is was very difficult to detect, so it would be nice to clean this up. For a test, you could try to install pypy 7.3.0 using cpython, see https://foss.heptapod.net/pypy/pypy/issues/3175. Although now that we know we will probably fix it for PyPy's next release. |
Co-Authored-By: Nicola Soranzo <[email protected]>
The test failure is also happening in master, so unrelated to this change. |
Thanks @ronaldoussoren for the PR, and @jaraco for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
GH-19110 is a backport of this pull request to the 3.8 branch. |
Sorry, @ronaldoussoren and @jaraco, I could not cleanly backport this to |
…ythonGH-9516) * bpo-22490: Remove "__PYVENV_LAUNCHER__" from the shell environment on macOS This changeset removes the environment varialbe "__PYVENV_LAUNCHER__" during interpreter launch as it is only needed to communicate between the stub executable in framework installs and the actual interpreter. Leaving the environment variable present may lead to misbehaviour when launching other scripts. * Actually commit the changes for issue 22490... * Correct typo Co-Authored-By: Nicola Soranzo <[email protected]> * Run make patchcheck Co-authored-by: Jason R. Coombs <[email protected]> Co-authored-by: Nicola Soranzo <[email protected]> (cherry picked from commit 044cf94) Co-authored-by: Ronald Oussoren <[email protected]>
GH-19111 is a backport of this pull request to the 3.7 branch. |
…H-9516) (GH-19110) * bpo-22490: Remove "__PYVENV_LAUNCHER__" from the shell environment on macOS This changeset removes the environment varialbe "__PYVENV_LAUNCHER__" during interpreter launch as it is only needed to communicate between the stub executable in framework installs and the actual interpreter. Leaving the environment variable present may lead to misbehaviour when launching other scripts. * Actually commit the changes for issue 22490... * Correct typo Co-Authored-By: Nicola Soranzo <[email protected]> * Run make patchcheck Co-authored-by: Jason R. Coombs <[email protected]> Co-authored-by: Nicola Soranzo <[email protected]> (cherry picked from commit 044cf94) Co-authored-by: Ronald Oussoren <[email protected]> Co-authored-by: Ronald Oussoren <[email protected]>
…aunch (GH-9516) (GH-19111) * bpo-22490: Remove "__PYVENV_LAUNCHER__" from the shell environment on macOS This changeset removes the environment varialbe "__PYVENV_LAUNCHER__" during interpreter launch as it is only needed to communicate between the stub executable in framework installs and the actual interpreter. Leaving the environment variable present may lead to misbehaviour when launching other scripts. * Actually commit the changes for issue 22490... * Correct typo Co-Authored-By: Nicola Soranzo <[email protected]> * Run make patchcheck Co-authored-by: Jason R. Coombs <[email protected]> Co-authored-by: Nicola Soranzo <[email protected]>. (cherry picked from commit 044cf94) Co-authored-by: Ronald Oussoren <[email protected]> Co-authored-by: Ronald Oussoren <[email protected]>
Exactly how this all works isn't clear, but since the fix in python/cpython#9516 was to simply hide the environment variable from the interpreter it seems reasonably safe. Fixes #27377.
Alternative patch for bpo-22490 that removes the shell environment variable PYVENV_LAUNCHER during interpreter launch because it is only used to communicate between the stub executable in Mac/Tools/pythonw.c and the real interpreter.
This avoids problems when launching the "real" interpreter without going through the stub executable.
https://bugs.python.org/issue22490