summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorBar Harel <bzvi7919@gmail.com>2019-12-23 18:31:15 (GMT)
committerIvan Levkivskyi <levkivskyi@gmail.com>2019-12-23 18:31:15 (GMT)
commit59d06b987db34cde8783e265709366d244c9e35b (patch)
tree203e76c6da36fa015b0dfd79da7b538e0731baba /Lib/os.py
parent0ffc90031cadf5637cfc13a40899e71c259c49b1 (diff)
downloadcpython-59d06b987db34cde8783e265709366d244c9e35b.zip
cpython-59d06b987db34cde8783e265709366d244c9e35b.tar.gz
cpython-59d06b987db34cde8783e265709366d244c9e35b.tar.bz2
[3.7] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17685)
https://bugs.python.org/issue38878
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/os.py b/Lib/os.py
index b93f95d..9853e37 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -26,6 +26,8 @@ import abc
import sys
import stat as st
+from _collections_abc import _check_methods
+
_names = sys.builtin_module_names
# Note: more names are added to __all__ later.
@@ -1076,4 +1078,6 @@ class PathLike(abc.ABC):
@classmethod
def __subclasshook__(cls, subclass):
- return hasattr(subclass, '__fspath__')
+ if cls is PathLike:
+ return _check_methods(subclass, '__fspath__')
+ return NotImplemented