You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original intent for the “accessor” thing was to have a variant that did all accesses under a filesystem tree in a race condition-free way using openat and friends. It turned out to be much too hairy to actually implement, so was entirely abandoned, but the accessor abstraction was left there.
This change is actually causing a problem for me. I have a unit test case which mocks out os.path.expanduser() but not the pathlib version. This works in 3.10 and earlier due to the indirection of the accessors, but in 3.11 the code ends up failing, since now the pathlib version of expanduser() is also getting into my mock.
I wonder if there might be other code out there which also might be depending on this behavior, without even realizing it.
Activity
barneygale commentedon Jan 23, 2021
Per Pitrou:
https://discuss.python.org/t/make-pathlib-extensible/3428/2
Accessors are:
Pathobjects themselves (inc. subclasses)Pathobjects, but once once bpo-24132 lands there will be a supported route for that.When bpo-24132 lands, I think we're free to remove accessors and simplify some code
merwok commentedon Jan 16, 2022
PR looks good, just needs a look by a pathlib expert.
barneygale commentedon Jan 16, 2022
Thank you Éric!
miss-islington commentedon Feb 2, 2022
New changeset 08f8301 by Barney Gale in branch 'main':
bpo-43012: remove
pathlib._Accessor(GH-25701)08f8301
ronf commentedon May 28, 2022
This change is actually causing a problem for me. I have a unit test case which mocks out os.path.expanduser() but not the pathlib version. This works in 3.10 and earlier due to the indirection of the accessors, but in 3.11 the code ends up failing, since now the pathlib version of expanduser() is also getting into my mock.
I wonder if there might be other code out there which also might be depending on this behavior, without even realizing it.