summaryrefslogtreecommitdiffstats
path: root/Lib/ntpath.py
diff options
context:
space:
mode:
authorBrian Curtin <brian.curtin@gmail.com>2010-09-06 19:46:17 (GMT)
committerBrian Curtin <brian.curtin@gmail.com>2010-09-06 19:46:17 (GMT)
commit13a0db5ddbb53c504574743207524b037945552c (patch)
tree7041e536b3a6c01108de8b3862fca8e1c5eda79c /Lib/ntpath.py
parent4bc12ef47dd57abda134fc0e90f946d862d8989e (diff)
downloadcpython-13a0db5ddbb53c504574743207524b037945552c.zip
cpython-13a0db5ddbb53c504574743207524b037945552c.tar.gz
cpython-13a0db5ddbb53c504574743207524b037945552c.tar.bz2
Fix some errors that #7566 introduced on non-Windows platforms due to
an ImportError. Rearranged the import, faked out the implementation when the import fails, and reorganized a test that depends on Win32 behavior.
Diffstat (limited to 'Lib/ntpath.py')
-rw-r--r--Lib/ntpath.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index eae3cf3..4a121f52 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -10,7 +10,6 @@ import sys
import stat
import genericpath
from genericpath import *
-from nt import _getfileinformation
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"basename","dirname","commonprefix","getsize","getmtime",
@@ -656,4 +655,10 @@ def samefile(f1, f2):
def sameopenfile(f1, f2):
"""Test whether two file objects reference the same file"""
- return _getfileinformation(f1) == _getfileinformation(f2)
+ try:
+ from nt import _getfileinformation
+ return _getfileinformation(f1) == _getfileinformation(f2)
+ except ImportError:
+ # On other operating systems, return True if the file descriptors
+ # are the same.
+ return f1 == f2