[Python-checkins] r84992 - python/branches/py3k/Lib/ntpath.py
brian.curtin
python-checkins at python.org
Fri Sep 24 15:56:34 CEST 2010
Author: brian.curtin
Date: Fri Sep 24 15:56:34 2010
New Revision: 84992
Log:
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.
Modified:
python/branches/py3k/Lib/ntpath.py
Modified: python/branches/py3k/Lib/ntpath.py
==============================================================================
--- python/branches/py3k/Lib/ntpath.py (original)
+++ python/branches/py3k/Lib/ntpath.py Fri Sep 24 15:56:34 2010
@@ -642,12 +642,17 @@
# determine if two files are in fact the same file
try:
- from nt import _getfinalpathname
-except (NotImplementedError, ImportError):
+ # 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
+ else:
+ raise ImportError
+except (AttributeError, ImportError):
# On Windows XP and earlier, two files are the same if their absolute
# pathnames are the same.
- # Also, on other operating systems, fake this method with a
- # Windows-XP approximation.
+ # Non-Windows operating systems fake this method with an XP
+ # approximation.
def _getfinalpathname(f):
return abspath(f)
More information about the Python-checkins
mailing list