Skip to content

Commit 22942e4

Browse files
committed
Remove Path._supported
1 parent f0beb66 commit 22942e4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/pathlib.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ class PurePosixPath(PurePath):
768768
However, you can also instantiate it directly on any system.
769769
"""
770770
_pathmod = posixpath
771-
_supported = (os.name != 'nt')
772771
_case_insensitive = False
773772
__slots__ = ()
774773

@@ -813,7 +812,6 @@ class PureWindowsPath(PurePath):
813812
# Reference for Windows paths can be found at
814813
# http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx
815814
_pathmod = ntpath
816-
_supported = (os.name == 'nt')
817815
_case_insensitive = True
818816
__slots__ = ()
819817

@@ -922,7 +920,8 @@ class Path(PurePath):
922920
def __new__(cls, *args, **kwargs):
923921
if cls is Path:
924922
cls = WindowsPath if os.name == 'nt' else PosixPath
925-
elif not cls._supported:
923+
elif (issubclass(cls, PosixPath) and os.name == 'nt') or \
924+
(issubclass(cls, WindowsPath) and os.name != 'nt'):
926925
raise NotImplementedError("cannot instantiate %r on your system"
927926
% (cls.__name__,))
928927
return cls._from_parts(args)

0 commit comments

Comments
 (0)