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

Skip to content
Merged
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
Tiny tweaks
  • Loading branch information
barneygale committed Mar 31, 2024
commit 69dabd2aa0860476e27f3a899e7f4e633dae0784
6 changes: 3 additions & 3 deletions Lib/posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def realpath(filename, *, strict=False):
pardir = '..'
getcwd = os.getcwd

path = sep if filename.startswith(sep) else getcwd()
path = sep if filename[:1] == sep else getcwd()
rest = filename.split(sep)[::-1]
Comment thread
barneygale marked this conversation as resolved.
Comment thread
barneygale marked this conversation as resolved.
seen = {}
querying = True
Expand Down Expand Up @@ -463,7 +463,7 @@ def realpath(filename, *, strict=False):
# Return already resolved part + rest of the path unchanged.
path = newpath
querying = False
continue
continue
try:
st = os.lstat(newpath)
if not stat.S_ISLNK(st.st_mode):
Expand All @@ -479,7 +479,7 @@ def realpath(filename, *, strict=False):
continue

seen[newpath] = None # not resolved symlink
if target.startswith(sep):
if target[:1] == sep:
path = sep
rest.append(newpath)
rest.append(None)
Expand Down