bpo-46362: Ensure ntpath.abspath() uses the Windows API correctly (GH-30571)

This makes ntpath.abspath()/getpath_abspath() follow normpath(), since some WinAPIs such as PathCchSkipRoot() require backslashed paths.
This commit is contained in:
neonene 2022-01-14 08:35:42 +09:00 committed by GitHub
parent b8ddf7e794
commit d4e64cd4b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 114 additions and 42 deletions

View file

@ -551,7 +551,7 @@ else: # use native Windows method on Windows
def abspath(path):
"""Return the absolute version of a path."""
try:
return normpath(_getfullpathname(path))
return _getfullpathname(normpath(path))
except (OSError, ValueError):
return _abspath_fallback(path)