Fix #9790 again. Rather than handle NotImplementedError at runtime as
before, only attempt the import where nt._getfinalpathname could actually work, i.e., Windows Vista and beyond.
This commit is contained in:
parent
0151b8edda
commit
e8e8042bb5
|
@ -642,12 +642,17 @@ def relpath(path, start=curdir):
|
||||||
|
|
||||||
# determine if two files are in fact the same file
|
# determine if two files are in fact the same file
|
||||||
try:
|
try:
|
||||||
|
# GetFinalPathNameByHandle is available starting with Windows 6.0.
|
||||||
|
# Windows XP and non-Windows OS'es will mock _getfinalpathname.
|
||||||
|
if sys.getwindowsversion()[:2] >= (6, 0):
|
||||||
from nt import _getfinalpathname
|
from nt import _getfinalpathname
|
||||||
except (NotImplementedError, ImportError):
|
else:
|
||||||
|
raise ImportError
|
||||||
|
except (AttributeError, ImportError):
|
||||||
# On Windows XP and earlier, two files are the same if their absolute
|
# On Windows XP and earlier, two files are the same if their absolute
|
||||||
# pathnames are the same.
|
# pathnames are the same.
|
||||||
# Also, on other operating systems, fake this method with a
|
# Non-Windows operating systems fake this method with an XP
|
||||||
# Windows-XP approximation.
|
# approximation.
|
||||||
def _getfinalpathname(f):
|
def _getfinalpathname(f):
|
||||||
return abspath(f)
|
return abspath(f)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue