Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
GH-103548: Improve performance ofpathlib.Path.[is_]absolute()#103549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Pass the *unnormalized* path to `os.path.isabs()`.When making an empty path absolute, avoid calling `os.path.join()`, andprevent pathlib from later re-normalizing the result of `os.getcwd()` bystoring it as `path._str`.
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2023-04-14-21-16-05.gh-issue-103548.lagdpp.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
AlexWaygood left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM!
pythonGH-103549)Improve performance of `pathlib.Path.absolute()` and `cwd()` by joining paths only when necessary. Also improveperformance of `PurePath.is_absolute()` on Posix by skipping path parsing and normalization.
Uh oh!
There was an error while loading.Please reload this page.
Pass theunnormalized path to
os.path.isabs():When making an empty path absolute, avoid calling
os.path.join(), and prevent pathlib from later re-normalizing the result ofos.getcwd()by storing it aspath._str:pathlib.Path.[is_]absolute()#103548