Subclassing `os.PathLike` rather than using `register()` makes
initialisation slower, due to the additional `__isinstance__` work.
This partially reverts commit
bd1b6228d132b8e9836fe352cd8dca2b6c1bd98c.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
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
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.