GH-89812: Add pathlib._PurePathExt
by barneygale · Pull Request #104810 · python/cpython (original) (raw)
I've revised the implementation such that the methods are actually removed from PurePath
. This will allow our future AbstractPath
class to inherit PurePath
, as it should conceptually:
(Contrast this with the earlier proposed hierarchy where PurePath
and AbstractPath
are siblings.
The methods are moved to a new _PurePathExt
class, which is inherited by PurePosixPath
, PureWindowsPath
and Path
.
This change will not be visible to users who try to instantiate PurePath
, because they'll always get a PurePosixPath
or PureWindowsPath
instance back.
It will be visible to users who subclass PurePath
, but that has only just become possible in 3.12. As such I think it's worth backporting this into 3.12 for consistency.