Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Keep querying if we hit an OSError from lstat()
  • Loading branch information
barneygale committed Apr 4, 2024
commit d2a024803aac420755071ba90e6e597af2065082
1 change: 0 additions & 1 deletion Lib/posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ def realpath(filename, *, strict=False):
if strict:
raise
path = newpath
querying = False
continue
# Resolve the symbolic link
if newpath in seen:
Expand Down
9 changes: 9 additions & 0 deletions Lib/test/test_posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,15 @@ def test_realpath_relative(self):
finally:
os_helper.unlink(ABSTFN)

@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_missing_pardir(self):
try:
os.symlink(os_helper.TESTFN + "1", os_helper.TESTFN)
self.assertEqual(realpath("nonexistent/../" + os_helper.TESTFN), ABSTFN + "1")
finally:
os_helper.unlink(os_helper.TESTFN)

@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_symlink_loops(self):
Expand Down