issue27186: add PathLike ABC
diff --git a/Lib/os.py b/Lib/os.py
index 0131ed8..e7d089e 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -22,7 +22,7 @@
"""
#'
-
+import abc
import sys, errno
import stat as st
@@ -1125,3 +1125,18 @@
raise TypeError("expected str, bytes or os.PathLike object, not "
+ path_type.__name__)
+
+class PathLike(abc.ABC):
+ """
+ Abstract base class for implementing the file system path protocol.
+ """
+ @abc.abstractmethod
+ def __fspath__(self):
+ """
+ Return the file system path representation of the object.
+ """
+ raise NotImplementedError
+
+ @classmethod
+ def __subclasshook__(cls, subclass):
+ return hasattr(subclass, '__fspath__')