Skip to content
Merged
Prev Previous commit
Add fast resolution path and minor doc update
  • Loading branch information
zooba committed Aug 21, 2019
commit 5d560b8a5dc0c2ce661e4f3ee42d59fe4d5cd498
3 changes: 2 additions & 1 deletion Doc/library/os.path.rst
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ the :mod:`glob` module.)
Accepts a :term:`path-like object`.

.. versionchanged:: 3.8
Symbolic links are now resolved on Windows.
Symbolic links and junctions are now resolved on Windows.


.. function:: relpath(path, start=os.curdir)

Expand Down
7 changes: 7 additions & 0 deletions Lib/ntpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,13 @@ def _readlink_deep(path, seen=None):
return path

def _getfinalpathname_nonstrict(path):
# Fast path to get the final path name. If this succeeds, there
# is no need to go any further.
try:
return _getfinalpathname(path)
except OSError:
pass

# Allow file (2) or directory (3) not found, invalid syntax (123),
# and symlinks that cannot be followed (1921)
allowed_winerror = 2, 3, 123, 1921
Expand Down