Skip to content

perf: use os.path.abspath() instead of Path.resolve()#326

Merged
Secrus merged 1 commit intopypa:mainfrom
radoering:perf-regression
Apr 8, 2026
Merged

perf: use os.path.abspath() instead of Path.resolve()#326
Secrus merged 1 commit intopypa:mainfrom
radoering:perf-regression

Conversation

@radoering
Copy link
Copy Markdown
Contributor

There is a significant performance regression due to #317. The time to install a sample project with some dependencies increased from 8 seconds (Poetry 2.3.2) to 13 seconds (Poetry 2.3.3). (Poetry applies the same fix.)

This can be fixed by using os.path.abspath() instead of Path.resolve().

This should be safe. At least, I could not craft a wheel that triggers a path traversal via symlinks. Also see the unit test in python-poetry/poetry#10821. Further, os.path.abspath() is recommended in https://docs.python.org/3/library/zipfile.html#zipfile.Path and (if I do not miss anything) pip also uses os.path.abspath() (and not Path.resolve()): https://github.com/pypa/pip/blob/8c5468dc9695c023c0a6428e630126aa14c9db4e/src/pip/_internal/utils/unpacking.py#L79-L87

Additionally, remove the Windows long path workaround because it should not be required if we no not resolve paths.

Additionally, remove the Windows long path workaround because it should not be required if we no not resolve paths.
@Secrus Secrus merged commit 8b72cf9 into pypa:main Apr 8, 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.

3 participants