]> granicus.if.org Git - python/commitdiff
Catch OSError raised when src or dst argument to os.path.samefile doesn't
authorJohannes Gijsbers <jlg@dds.nl>
Sat, 14 Aug 2004 14:51:01 +0000 (14:51 +0000)
committerJohannes Gijsbers <jlg@dds.nl>
Sat, 14 Aug 2004 14:51:01 +0000 (14:51 +0000)
exist.

Lib/shutil.py

index d361fa2b5d5caef66044b2653a4d4a8b80faab81..43726b473654cefefe6dac8a737b9940b0ae5144 100644 (file)
@@ -27,7 +27,10 @@ def copyfileobj(fsrc, fdst, length=16*1024):
 def _samefile(src, dst):
     # Macintosh, Unix.
     if hasattr(os.path,'samefile'):
-        return os.path.samefile(src, dst)
+        try:
+            return os.path.samefile(src, dst)
+        except OSError:
+            return False
 
     # All other platforms: check for same pathname.
     return (os.path.normcase(os.path.abspath(src)) ==