File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -768,7 +768,6 @@ class PurePosixPath(PurePath):
768
768
However, you can also instantiate it directly on any system.
769
769
"""
770
770
_pathmod = posixpath
771
- _supported = (os .name != 'nt' )
772
771
_case_insensitive = False
773
772
__slots__ = ()
774
773
@@ -813,7 +812,6 @@ class PureWindowsPath(PurePath):
813
812
# Reference for Windows paths can be found at
814
813
# http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx
815
814
_pathmod = ntpath
816
- _supported = (os .name == 'nt' )
817
815
_case_insensitive = True
818
816
__slots__ = ()
819
817
@@ -922,7 +920,8 @@ class Path(PurePath):
922
920
def __new__ (cls , * args , ** kwargs ):
923
921
if cls is Path :
924
922
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' ):
926
925
raise NotImplementedError ("cannot instantiate %r on your system"
927
926
% (cls .__name__ ,))
928
927
return cls ._from_parts (args )
You can’t perform that action at this time.
0 commit comments