Skip to content

Commit b769371

Browse files
committed
Store reference to function
1 parent bcc160e commit b769371

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/ntpath.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,12 @@ def abspath(path):
580580
pass
581581
path = os.fspath(path)
582582
if not isabs(path):
583-
if is_bytes := isinstance(path, bytes):
583+
if isinstance(path, bytes):
584584
sep = b'\\'
585+
getcwd = os.getcwdb
585586
else:
586587
sep = '\\'
588+
getcwd = os.getcwd
587589
drive, root, path = splitroot(path)
588590
# Either drive or root can be nonempty, but not both.
589591
if drive or root:
@@ -593,8 +595,7 @@ def abspath(path):
593595
# Drive "\0:" cannot exist; use the root directory.
594596
path = drive + sep + path
595597
else:
596-
cwd = os.getcwdb() if is_bytes else os.getcwd()
597-
path = join(cwd, path)
598+
path = join(getcwd(), path)
598599
return normpath(path)
599600

600601
try:

0 commit comments

Comments
 (0)