mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
In abspath(), always use normpath(), even when win32api is available
(and even when it fails). This avoids the problem where a trailing separator is not removed when win32api.GetFullPathName() is used.
This commit is contained in:
parent
d25c1b73d2
commit
6dfc792fea
1 changed files with 3 additions and 3 deletions
|
@ -404,10 +404,10 @@ def abspath(path):
|
||||||
try:
|
try:
|
||||||
import win32api
|
import win32api
|
||||||
try:
|
try:
|
||||||
return win32api.GetFullPathName(path)
|
path = win32api.GetFullPathName(path)
|
||||||
except win32api.error:
|
except win32api.error:
|
||||||
return path # Bad path - return unchanged.
|
pass # Bad path - return unchanged.
|
||||||
except ImportError:
|
except ImportError:
|
||||||
if not isabs(path):
|
if not isabs(path):
|
||||||
path = join(os.getcwd(), path)
|
path = join(os.getcwd(), path)
|
||||||
return normpath(path)
|
return normpath(path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue