Skip to content

Commit 4b83c97

Browse files
committed
Final tweaks
1 parent ecd1fe7 commit 4b83c97

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/posixpath.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def realpath(filename, *, strict=False):
428428

429429
# The resolved path, which is absolute throughout this function.
430430
# Note: getcwd() returns a normalized and symlink-free path.
431-
path = sep if filename[:1] == sep else getcwd()
431+
path = sep if filename.startswith(sep) else getcwd()
432432

433433
# Mapping from symlink paths to *fully resolved* symlink targets. If a
434434
# symlink is encountered but not yet resolved, the value is None. This is
@@ -490,13 +490,13 @@ def realpath(filename, *, strict=False):
490490
path = newpath
491491
querying = False
492492
continue
493-
if target[:1] == sep:
493+
if target.startswith(sep):
494494
# Symlink target is absolute; reset resolved path.
495495
path = sep
496496
seen[newpath] = None # not resolved symlink
497497
# Push the symlink path onto the stack, and signal its specialness by
498498
# also pushing None. When these entries are popped, we'll record the
499-
# fully-resolved symlink target in the 'seen' mapping .
499+
# fully-resolved symlink target in the 'seen' mapping.
500500
rest.append(newpath)
501501
rest.append(None)
502502
# Push the unresolved symlink target parts onto the stack.

0 commit comments

Comments
 (0)