-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize joining of pathlib.PurePath() arguments. #104996
Comments
Joining of arguments is moved to `_load_parts`, which is called when a normalized path is needed.
The reason for (maybe) re-implementing Any implementation of path joining must keep a running record of the current drive, root and tail, and update them by calling |
Joining of arguments is moved to `_load_parts`, which is called when a normalized path is needed.
…thonGH-104999) Joining of arguments is moved to `_load_parts`, which is called when a normalized path is needed. (cherry picked from commit ffeaec7)
…ts. (pythonGH-104999) Joining of arguments is moved to `_load_parts`, which is called when a normalized path is needed.. (cherry picked from commit ffeaec7) Co-authored-by: Barney Gale <barney.gale@gmail.com>
Copy the `ntpath.join()` algorithm into pathlib and adjust it to remove string concatenation. The resulting drive, root and tail are stored on the path object without creating an intermediate joined path.
In Python 3.12, when multiple arguments are given to
PurePath()
, the initialiser callsos.path.join()
to join them. This is reasonably slow. For Python 3.13 we can make it faster by:os.path.join()
, as pathlib did before gh-94909: fix joining of absolute and relative Windows paths in pathlib #95450.Linked PRs
pathlib.PurePath()
arguments. #104999pathlib.PurePath()
arguments. (GH-104999) #105483The text was updated successfully, but these errors were encountered: