diff options
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 87c2e97..a57b582 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -235,7 +235,7 @@ class _PathParents(Sequence): return "<{}.parents>".format(type(self._path).__name__) -class PurePath(os.PathLike): +class PurePath: """Base class for manipulating paths without I/O. PurePath represents a filesystem path and offers operations which @@ -715,6 +715,10 @@ class PurePath(os.PathLike): return False return True +# Subclassing os.PathLike makes isinstance() checks slower, +# which in turn makes Path construction slower. Register instead! +os.PathLike.register(PurePath) + class PurePosixPath(PurePath): """PurePath subclass for non-Windows systems. |