You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
venv on Windows preserves the \\?\ extended-length path prefix in sys.prefix on 3.14, unlike 3.10 - breaks tools that join sysconfig paths with relative (..) components #157917
pip install of the built wheel into the \\?\-prefixed venv above fails with:
ERROR: Could not install packages due to an OSError: [Errno 22] Invalid argument:
'\\?\C:\path\to\venv\Lib\site-packages\../../Scripts\bottle.py'
(Without the shebang line, the same package installs fine — the shebang is what makes pip rewrite the file and recompute its hash, which is what hits the broken path.)
(pip joins lib_dir with a RECORD-relative path like ../../Scripts/bottle.py via plain os.path.join — harmless on a normal path, but Windows does not resolve ..// for \\?\ paths, so open() rejects it. Reproduced identically with pip 24.3.1 and pip 26.2.1 — not pip-version-dependent.)
Root cause
3.10 (PC/getpathp.c): the executable path used to derive sys.prefix always comes from GetModuleFileNameW(NULL, ...) — a WinAPI call that reports the OS's own canonical module path and never includes \\?\, regardless of how the process was invoked.
3.14 (Modules/getpath.py/getpath.c): executable is taken from config.get('executable') (populated from the literal argv[0] used to invoke the process) and only falls back to the GetModuleFileNameW-derived real_executable when that's empty. Since argv[0] was \\?\C:\...\python.exe, it's used verbatim, \\?\ and all.
Suggested fix
In Modules/getpath.py, prefer real_executable (or strip a leading \\?\ / \\?\UNC\) over the literal configured executable on Windows when computing venv_prefix/prefix, restoring 3.10's behavior of always resolving through the OS-reported canonical path rather than trusting the invocation string.
Activity
pythongh-157917: Do not leak the \\?\ extended-length prefix into sys…