diff options
author | Bar Harel <bzvi7919@gmail.com> | 2019-12-23 18:31:00 (GMT) |
---|---|---|
committer | Ivan Levkivskyi <levkivskyi@gmail.com> | 2019-12-23 18:31:00 (GMT) |
commit | 0846e5d4603434c2bbf8a528677cf1ff3fe29b95 (patch) | |
tree | f44bd35fa8bc5c58ed22085a8d5a31c9172dacaf /Lib/os.py | |
parent | 7eb8c6d2c89a8a7ba3af4a99ab20456dff544881 (diff) | |
download | cpython-0846e5d4603434c2bbf8a528677cf1ff3fe29b95.zip cpython-0846e5d4603434c2bbf8a528677cf1ff3fe29b95.tar.gz cpython-0846e5d4603434c2bbf8a528677cf1ff3fe29b95.tar.bz2 |
[3.8] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17684)
https://bugs.python.org/issue38878
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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. @@ -1070,7 +1072,9 @@ class PathLike(abc.ABC): @classmethod def __subclasshook__(cls, subclass): - return hasattr(subclass, '__fspath__') + if cls is PathLike: + return _check_methods(subclass, '__fspath__') + return NotImplemented if name == 'nt': |