File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -1056,20 +1056,25 @@ def resolve(self, strict=False):
10561056 Windows).
10571057 """
10581058
1059+ def check_eloop (e ):
1060+ winerror = getattr (e , 'winerror' , 0 )
1061+ if e .errno == ELOOP or winerror == _WINERROR_CANT_RESOLVE_FILENAME :
1062+ raise RuntimeError ("Symlink loop from %r" % e .filename )
1063+
10591064 try :
10601065 s = self ._accessor .realpath (self , strict = strict )
1061- p = self ._from_parts ((s ,))
1066+ except OSError as e :
1067+ check_eloop (e )
1068+ raise
1069+ p = self ._from_parts ((s ,))
10621070
1063- # In non-strict mode, realpath() doesn't raise on symlink loops.
1064- # Ensure we get an exception by calling stat()
1065- if not strict :
1071+ # In non-strict mode, realpath() doesn't raise on symlink loops.
1072+ # Ensure we get an exception by calling stat()
1073+ if not strict :
1074+ try :
10661075 p .stat ()
1067- except OSError as ex :
1068- winerror = getattr (ex , 'winerror' , 0 )
1069- if ex .errno == ELOOP or winerror == _WINERROR_CANT_RESOLVE_FILENAME :
1070- raise RuntimeError ("Symlink loop from %r" , ex .filename )
1071- if strict :
1072- raise
1076+ except OSError as e :
1077+ check_eloop (e )
10731078 return p
10741079
10751080 def stat (self , * , follow_symlinks = True ):
You can’t perform that action at this time.
0 commit comments