summaryrefslogtreecommitdiffstats
path: root/Lib/ntpath.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/ntpath.py')
-rw-r--r--Lib/ntpath.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index 63860ce7..47c1acf 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -404,21 +404,12 @@ def normpath(path):
# Return an absolute path.
def abspath(path):
"""Return the absolute version of a path"""
- try:
- import win32api
- except ImportError:
- global abspath
- def _abspath(path):
- if not isabs(path):
- path = join(os.getcwd(), path)
- return normpath(path)
- abspath = _abspath
- return _abspath(path)
if path: # Empty path must return current working directory.
+ from nt import _getfullpathname
try:
- path = win32api.GetFullPathName(path)
- except win32api.error:
- pass # Bad path - return unchanged.
+ path = _getfullpathname(path)
+ except WindowsError:
+ pass # Bad path - return unchanged.
else:
path = os.getcwd()
return normpath(path)