Skip to content
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

In python3.11 getpath.py calculates zip path with default prefix in a venv which breaks venv created fron non-installed python #99370

Closed
kkpattern opened this issue Nov 11, 2022 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@kkpattern
Copy link
Contributor

kkpattern commented Nov 11, 2022

Bug report

In python3.11, getpath.py calculates zip path with default prefix in a venv. Before python3.11, the zip path is calculated with prefix instead if in a venv.

This change breaks a venv created from a non-installed python with a stdlib zip file.

Related discussion: https://discuss.python.org/t/python3-11-seems-to-break-venv-created-from-non-system-python-with-zipped-stdlib/20874/7

Your environment

  • CPython versions tested on: python3.11.0, main
  • Operating system and architecture:
    Debian 11. AMD64.
@kkpattern kkpattern added the type-bug An unexpected behavior, bug, or error label Nov 11, 2022
zooba pushed a commit that referenced this issue Nov 14, 2022
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.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 14, 2022
…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 <kylerzhang11@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 14, 2022
…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 <kylerzhang11@gmail.com>
miss-islington added a commit that referenced this issue Nov 14, 2022
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 <kylerzhang11@gmail.com>
@kkpattern
Copy link
Contributor Author

Sorry, seems the newly added test case will fail with shared enabled python builds. I'm preparing a fix here.

zooba pushed a commit that referenced this issue Nov 15, 2022
When build with shared enabled, we need to set `LD_LIBRARY_PATH`
for the non-installed python environment in
test_zippath_from_non_installed_posix so that the python binary
and find and link the libpython.so.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 15, 2022
…9483)

When build with shared enabled, we need to set `LD_LIBRARY_PATH`
for the non-installed python environment in
test_zippath_from_non_installed_posix so that the python binary
and find and link the libpython.so.
(cherry picked from commit 1df0752)

Co-authored-by: Kai Zhang <kylerzhang11@gmail.com>
@zooba
Copy link
Member

zooba commented Nov 15, 2022

Thanks for the quick fix!

@zooba zooba closed this as completed Nov 15, 2022
miss-islington added a commit that referenced this issue Nov 15, 2022
When build with shared enabled, we need to set `LD_LIBRARY_PATH`
for the non-installed python environment in
test_zippath_from_non_installed_posix so that the python binary
and find and link the libpython.so.
(cherry picked from commit 1df0752)

Co-authored-by: Kai Zhang <kylerzhang11@gmail.com>
zooba added a commit to zooba/cpython that referenced this issue Nov 16, 2022
CuriousLearner added a commit to CuriousLearner/cpython that referenced this issue Nov 16, 2022
* 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)
  ...
zooba added a commit to zooba/cpython that referenced this issue Nov 16, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 16, 2022
…for test (pythonGH-99523)

(cherry picked from commit 7c57857)

Co-authored-by: Steve Dower <steve.dower@python.org>
miss-islington added a commit that referenced this issue Nov 16, 2022
…st (GH-99523)

(cherry picked from commit 7c57857)

Co-authored-by: Steve Dower <steve.dower@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants