gh-129333: fix import error over nfs on Windows#129616
gh-129333: fix import error over nfs on Windows#129616ChrisDenton wants to merge 1 commit intopython:mainfrom
Conversation
On Windows, realpath uses `GetFinalPathNameByHandleW` to resolve paths. This returns paths starting with a `\\?\` prefix, which is usually not what we want. This change attempts to remove the prefix for \\?\UNC\ paths. A similar thing was already done for drive paths such as \\?\C:\.
|
The test failures in free-threading look unrelated to my eye but maybe I'm missing some context. E.g. I'm not sure how this change could cause cause a concurrency issue: |
|
@eryksun, would you mind having a look at this one? Thanks! |
I triggered a re-run, let's see if it reproduces. |
|
@nineteendo could also use your input, if you have time to look at this. Cheers! |
|
Well, I can't test this on my machine because python crashes with these warnings after the build (his is not a new issue): You still need to add tests though. |
I'm not sure how to add tests. |
|
Is there no other way to get |
Is it fixed in |
|
No, this issue is still open: #123414 UPDATE: fixed by creating a clean clone, but I can't install Python libraries it seems |
Hmm... maybe I could try using a |
|
That seems to work but the next problem I'm encountering is that there doesn't appear to be any existing unit tests for the C implementation of I could maybe test using |
|
This can be tested locally without needing to import anything by starting python with a \\?\UNC\localhost\c$\Users\Chris\Python\PCBuild\amd64\python.exe -c "import sysconfig; print(sysconfig.get_paths()['include'])"This should print the simplified path: However, this relies on the drive supporting |
On Windows,
getpath_realpathusesGetFinalPathNameByHandleWto resolve paths. This returns paths starting with a\\?\prefix, which is usually not what we want.This change attempts to remove the prefix for
\\?\UNC\paths. A similar thing was already done for drive paths such as\\?\C:\.