Skip to content

Commit 8f20c10

Browse files
committed
Use nt._getfullpathname instead of os.path.abspath
1 parent 7cff82e commit 8f20c10

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/pathlib.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
if os.name == 'nt':
18-
from nt import _getfinalpathname
18+
from nt import _getfinalpathname, _getfullpathname
1919
else:
2020
_getfinalpathname = None
2121

@@ -194,7 +194,7 @@ def resolve(self, path, strict=False):
194194
return None # Means fallback on absolute
195195
if strict:
196196
return self._ext_to_normal(_getfinalpathname(s))
197-
s = path = os.path.abspath(s)
197+
s = path = _getfullpathname(s)
198198
previous_s = None
199199
tail_parts = [] # End of the path after the first one not found
200200
while True:
@@ -204,7 +204,8 @@ def resolve(self, path, strict=False):
204204
previous_s = s
205205
s, tail = os.path.split(s)
206206
tail_parts.append(tail)
207-
if previous_s == s: # Root reached, fallback to abspath()
207+
if previous_s == s:
208+
# Root reached, fallback to _getfullpathname()
208209
return path
209210
else:
210211
return os.path.join(s, *reversed(tail_parts))

0 commit comments

Comments
 (0)