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

Skip to content

Commit 69dabd2

Browse files
committed
Tiny tweaks
1 parent 085e105 commit 69dabd2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/posixpath.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def realpath(filename, *, strict=False):
423423
pardir = '..'
424424
getcwd = os.getcwd
425425

426-
path = sep if filename.startswith(sep) else getcwd()
426+
path = sep if filename[:1] == sep else getcwd()
427427
rest = filename.split(sep)[::-1]
428428
seen = {}
429429
querying = True
@@ -463,7 +463,7 @@ def realpath(filename, *, strict=False):
463463
# Return already resolved part + rest of the path unchanged.
464464
path = newpath
465465
querying = False
466-
continue
466+
continue
467467
try:
468468
st = os.lstat(newpath)
469469
if not stat.S_ISLNK(st.st_mode):
@@ -479,7 +479,7 @@ def realpath(filename, *, strict=False):
479479
continue
480480

481481
seen[newpath] = None # not resolved symlink
482-
if target.startswith(sep):
482+
if target[:1] == sep:
483483
path = sep
484484
rest.append(newpath)
485485
rest.append(None)

0 commit comments

Comments
 (0)