gh-157917: Do not leak the \\?\ extended-length prefix into sys.prefix on Windows venvs (GH-158465)

When a venv interpreter is invoked through a "\\?\" extended-length path, the
venv launcher reports its own path via GetModuleFileNameW, which preserves
that prefix. getpath.py consumed the value verbatim, so sys.prefix,
sys.exec_prefix and sys.executable all kept the prefix.

Windows does not resolve ".." or any other relative component in an
extended-length path, so tools that join them onto a sysconfig path break.
That is what makes "pip install" of a wheel with a "scripts=" entry fail with
"OSError: [Errno 22] Invalid argument".

Strip the prefix back off the launcher-provided path on Windows. A path that
would still exceed MAX_PATH once unprefixed keeps the prefix, since the
extended-length form is the only usable one for it.
3 files changed