gh-99370: Calculate zip path from prefix when in a venv (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.
This commit is contained in:
Kai Zhang 2022-11-14 23:05:14 +08:00 committed by GitHub
parent a3ac9232f8
commit e3d4fed074
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 2 deletions

View file

@ -679,9 +679,8 @@ elif not pythonpath_was_set:
else:
library_dir = executable_dir
pythonpath.append(joinpath(library_dir, ZIP_LANDMARK))
elif build_prefix or venv_prefix:
elif build_prefix:
# QUIRK: POSIX uses the default prefix when in the build directory
# or a venv
pythonpath.append(joinpath(PREFIX, ZIP_LANDMARK))
else:
pythonpath.append(joinpath(prefix, ZIP_LANDMARK))