@@ -57,8 +57,6 @@ class _WindowsFlavour(_Flavour):
5757
5858 has_drv = True
5959
60- is_supported = (os .name == 'nt' )
61-
6260 def casefold (self , s ):
6361 return s .lower ()
6462
@@ -69,8 +67,6 @@ def casefold_parts(self, parts):
6967class _PosixFlavour (_Flavour ):
7068 has_drv = False
7169
72- is_supported = (os .name != 'nt' )
73-
7470 def casefold (self , s ):
7571 return s
7672
@@ -788,6 +784,7 @@ class PurePosixPath(PurePath):
788784 """
789785 _flavour = _posix_flavour
790786 _pathmod = posixpath
787+ _supported = (os .name != 'nt' )
791788 _case_insensitive = False
792789 __slots__ = ()
793790
@@ -828,6 +825,7 @@ class PureWindowsPath(PurePath):
828825 """
829826 _flavour = _windows_flavour
830827 _pathmod = ntpath
828+ _supported = (os .name == 'nt' )
831829 _case_insensitive = True
832830 _drive_letters = set ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' )
833831 _ext_namespace_prefix = '\\ \\ ?\\ '
@@ -940,11 +938,10 @@ class Path(PurePath):
940938 def __new__ (cls , * args , ** kwargs ):
941939 if cls is Path :
942940 cls = WindowsPath if os .name == 'nt' else PosixPath
943- self = cls ._from_parts (args )
944- if not self ._flavour .is_supported :
941+ elif not cls ._supported :
945942 raise NotImplementedError ("cannot instantiate %r on your system"
946943 % (cls .__name__ ,))
947- return self
944+ return cls . _from_parts ( args )
948945
949946 def _make_child_relpath (self , part ):
950947 # This is an optimization used for dir walking. `part` must be
0 commit comments