Skip to content

Fix long path issue on Windows#321

Merged
Secrus merged 1 commit intopypa:mainfrom
radoering:fix-windows-long-path-issue
Mar 29, 2026
Merged

Fix long path issue on Windows#321
Secrus merged 1 commit intopypa:mainfrom
radoering:fix-windows-long-path-issue

Conversation

@radoering
Copy link
Copy Markdown
Contributor

Path.is_relative_to() does not work if one of both paths has a long path prefix and the other has not. A long path prefix may be added when calling Path.resolve().

Originally, the issue was noticed in Poetry's CI. (Poetry applies the same check as installer.)
With additional debug output, the error looked like:

[68](https://github.com/radoering/poetry/actions/runs/23705665774/job/69057056580#step:5:6069)
E           Attempting to write py.test.exe outside of the target directory
E           Target directory: C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\popen-gw0\test_execute_prints_warning_fo1\.venv\scripts
E           Target path: \\?\C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\popen-gw0\test_execute_prints_warning_fo1\.venv\scripts\py.test.exe

Related Poetry PR: python-poetry/poetry#10794

Path.is_relative_to does not work if one of both paths has a long path prefix and the other has not. A long path prefix may be added when calling Path.resolve().
@radoering radoering force-pushed the fix-windows-long-path-issue branch from b5e8c2e to 477ff26 Compare March 29, 2026 13:10
@Secrus
Copy link
Copy Markdown
Member

Secrus commented Mar 29, 2026

Thank you for your contribution

@Secrus Secrus merged commit b5f03f1 into pypa:main Mar 29, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants