Closed
Description
Feature or enhancement
pathlib._abc.PurePathBase
and PathBase
have a few slots and methods that facilitate fast path object generation:
_drv
,_root
,_tail_cached
: roughly, the result ofos.path.splitroot()
on the path_str
: the normalized path string_make_child_relpath()
: used when walking directories_from_parsed_parts()
: used inparent
,parents
,with_name()
,relative_to()
These carefully-tuned features are useful in pathlib
, where speed is important, but much less so in pathlib._abc
, where the clarity of the interfaces and interactions should win out.
It should be possible to move them to PurePath
, leaving PurePathBase
with only _raw_paths
and _resolving
slots.
This should not affect the behaviour or performance of the public classes in pathlib
proper.
Linked PRs
- GH-113528: Move a few misplaced pathlib tests #113527
- GH-113528: Remove a couple of expensive pathlib ABC tests #113534
- GH-113528: Slightly improve
pathlib.Path.glob()
tests for symlink loop handling #113763 - GH-113528: Split up pathlib tests for invalid basenames. #113776
- GH-113528: pathlib ABC tests: add repr to dummy path classes. #113777
- GH-113528: Deoptimise
pathlib._abc.PurePathBase.name
#113531 - GH-113528: Deoptimise
pathlib._abc.PurePathBase.parent
#113530 - GH-113528: Deoptimise
pathlib._abc.PurePathBase.relative_to()
#113529 - GH-113528: Deoptimise
pathlib._abc.PurePathBase.is_absolute()
#113820 - GH-113528: Deoptimise
pathlib._abc.PathBase._make_child_relpath()
#113532 - GH-113528: Deoptimise
pathlib._abc.PathBase.resolve()
#113782 - GH-113528: Deoptimise
pathlib._abc.PurePathBase
#113559 - GH-113528: Speed up pathlib ABC tests. #113788
- GH-113528: Deoptimise
pathlib._abc.PurePathBase.relative_to()
(again) #113882 - GH-113528: Deoptimise
pathlib._abc.PurePathBase.parts
#113883