-
-
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
gh-99370: calculate zip path from prefix when in a venv #99371
Conversation
@zooba PR is created. 🥳 |
I looked at the failed Windows test case. It's because it's more complicated to create a "fake" non-installed python in tests on the Windows platform. On the other hand, the related code change only affects POSIX platform. So I think is reasonable to skip |
I don't think using I'd suggest grabbing a temp dir and copying |
But also, thinking about this, maybe the venv test isn't proving as much as I first thought. If it doesn't feel like it's falling into place, we probably can live without it. |
Cool. I will first try to update the test to manually create the non-installed environment. If then we still feel it's too tricky, we can remove it. At least it has helped us verify that the new behavior is consistent with python3.10. |
9b0a2eb
to
3110166
Compare
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Before python3.11, when in a venv the zip path is calculated from prefix on POSIX platforms. In python3.11 the behavior is accidentally changed to calculating from default prefix. This change will break venv created from a non-installed python with a stdlib zip file. This commit restore the behavior back to before python3.11.
3110166
to
d463c31
Compare
I have updated the |
Nice work! Thanks! |
Thanks @kkpattern for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
GH-99477 is a backport of this pull request to the 3.11 branch. |
…GH-99371) Before python3.11, when in a venv the zip path is calculated from prefix on POSIX platforms. In python3.11 the behavior is accidentally changed to calculating from default prefix. This change will break venv created from a non-installed python with a stdlib zip file. This commit restores the behavior back to before python3.11. (cherry picked from commit e3d4fed) Co-authored-by: Kai Zhang <[email protected]>
Thanks @kkpattern for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
…GH-99371) Before python3.11, when in a venv the zip path is calculated from prefix on POSIX platforms. In python3.11 the behavior is accidentally changed to calculating from default prefix. This change will break venv created from a non-installed python with a stdlib zip file. This commit restores the behavior back to before python3.11. (cherry picked from commit e3d4fed) Co-authored-by: Kai Zhang <[email protected]>
|
|
|
|
Before python3.11, when in a venv the zip path is calculated from prefix on POSIX platforms. In python3.11 the behavior is accidentally changed to calculating from default prefix. This change will break venv created from a non-installed python with a stdlib zip file. This commit restores the behavior back to before python3.11. (cherry picked from commit e3d4fed) Co-authored-by: Kai Zhang <[email protected]>
Looks like something is wrong with the |
|
|
|
OK. I figured out what happened. So if we enable shared python build. Besides |
I will try to follow the instruction on custom builders to test my fix. |
|
|
|
|
|
Go ahead and create a pull request for it, and we can apply the |
|
Thanks! I have created the PR: #99483 |
# First try to create a non-installed python. It's not a real full | ||
# functional non-installed python, but enough for this test. | ||
non_installed_dir = os.path.realpath(tempfile.mkdtemp()) | ||
try: |
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.
Rather than an enormous try
block, you can use self.addCleanup(rmtree, non_installed_dir)
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.
Thanks. Do I need to wait for the buildbots test to finish before pushing the change?
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.
Yeah, let's get the failures fixed and clean up afterwards :)
|
* main: (8272 commits) Update Windows readme.txt to clarify Visual Studio required versions (pythonGH-99522) pythongh-99460 Emscripten trampolines on optimized METH_O and METH_NOARGS code paths (python#99461) pythongh-92647: [Enum] use final status to determine lookup or create (pythonGH-99500) pythongh-81057: Move Globals in Core Code to _PyRuntimeState (pythongh-99496) Post 3.12.0a2 pythongh-99300: Use Py_NewRef() in Python/Python-ast.c (python#99499) pythongh-93649: Split pytime and datetime tests from _testcapimodule.c (python#99494) pythongh-99370: fix test_zippath_from_non_installed_posix (pythonGH-99483) pythonGH-99205: remove `_static` field from `PyThreadState` and `PyInterpreterState` (pythonGH-99385) pythongh-81057: Move the Remaining Import State Globals to _PyRuntimeState (pythongh-99488) pythongh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module (pythonGH-99373) pythongh-93649: Split getargs tests from _testcapimodule.c (python#99346) pythongh-81057: Move Global Variables Holding Objects to _PyRuntimeState. (pythongh-99487) pythonGH-98219: reduce sleep time in `asyncio` subprocess test (python#99464) pythonGH-99388: add `loop_factory` parameter to `asyncio.run` (python#99462) pythongh-99300: Use Py_NewRef() in PC/ directory (python#99479) pythongh-99300: Use Py_NewRef() in Doc/ directory (python#99480) pythongh-99300: Use Py_NewRef() in Modules/ directory (python#99473) pythongh-99300: Use Py_NewRef() in Modules/ directory (python#99469) pythongh-99370: Calculate zip path from prefix when in a venv (pythonGH-99371) ...
Before python3.11, when in a venv the zip path is calculated from prefix. In python3.11 the behavior is accidentally changed to calculating from the default prefix. This change will break venv created from a non-installed python with a stdlib zip file. This commit restores the behavior back to before python3.11.