Skip to content

Commit a82bc18

Browse files
committed
Do not suppress initial ERROR_CANT_RESOLVE_FILENAME error in non-strict mode.
1 parent f979947 commit a82bc18

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/ntpath.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,10 @@ def realpath(path, *, strict=False):
659659
path = _getfinalpathname(path)
660660
initial_winerror = 0
661661
except OSError as ex:
662-
if strict:
662+
# ERROR_CANT_RESOLVE_FILENAME (1921) is from exceeding the
663+
# max allowed number of reparse attempts (currently 63), which
664+
# is either due to a loop or a chain of links that's too long.
665+
if strict or ex.winerror == 1921:
663666
raise
664667
initial_winerror = ex.winerror
665668
path = _getfinalpathname_nonstrict(path)

0 commit comments

Comments
 (0)