-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
bpo-43012: remove pathlib._Accessor
#25701
bpo-43012: remove pathlib._Accessor
#25701
Conversation
3941ea1
to
5136c12
Compare
Note that a lot of my previous pathlib bugfixes were partly in preparation for making this diff look OK! I was hoping to highlight that I'm pretty sure the |
Bravo! I didn't realize yesterday with #25699 that it was temp code. I had seen your commits and misunderstood. I thought somehow your intent was to add a class in between Path and PurePath which leveraged moving all cwd, resolve, open, touch, into the accessor. I had done some performance testing that move of cwd, resolve, open, touch into the accessor and noted that it resulted in a significant slow down doing so.
I have to imagine that moving everything out will do the exact opposite and make all of these slow down go away and speed up all of the other functions that had used the accessor. That said, I'm just a guy out there who happens to be using pathlib, but I think this is brilliant. Myself, I had been wondering about changing the name of accessor to common (or something similar) having also seen Pitrou's comment to you, since it seemed like a vestigial abstraction. But I like taking it out entirely even better. Remove the cruft and make it faster - this seems like a win! |
Yep! And you'll note that the |
I'm also planning to perform an optimization pass, as I think there's a few |
@pitrou I think you wrote this code originally - do you have the time/inclination to review? Thanks so much! @serhiy-storchaka As you improved the performance of globbing in bpo-26032, do you have any feedback on the |
As for |
0124153
to
599e253
Compare
Thanks very much. I've renamed it to |
I'll wait for #26153 to land before rebasing. |
b0dcbd2
to
7a0882b
Compare
I've rebased this PR. I believe it's ready for core review! |
This PR is stale because it has been open for 30 days with no activity. |
7a0882b
to
d07f465
Compare
I'm still keen to land this if possible. Thanks! |
b55c5e7
to
013ddc6
Compare
Please avoid force push for future PRs, they make reviewing less pleasant: https://devguide.python.org/pullrequest/ |
Can you add a news entry? Can be just one line or two about removing an obsolete layer and preparing the terrain for upcoming enhancements. |
I've added a news entry now. I used your wording as it seemed spot on to me! |
These aren't necessary, and may slow things down.
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.
To me this looks ready to merge. Is anyone else reviewing it?
Thank you for the reviews, everyone. If you can spare the time to continue reviewing this PR series, the next one is at #31085. Thanks so much! |
Python 3.11 removed pathlib._Accessor in python/cpython#25701. This broke our patch when it replaced a call to `os.getcwd()` with `Path.cwd()` in `Path.absolute()`. As a classmethod `Path.cwd()` receives the class as its implicit first argument meaning we can have 0 or 1 arguments.
Per Pitrou:
https://discuss.python.org/t/make-pathlib-extensible/3428/2
Accessors are:
Path
objects themselves (inc. subclasses)Path
objects, but once once bpo-24132 is addressed there will be a supported route for that.This patch preserves all existing behaviour.
https://bugs.python.org/issue43012
Automerge-Triggered-By: GH:encukou