Catch OSError raised when src or dst argument to os.path.samefile doesn't

exist.
This commit is contained in:
Johannes Gijsbers 2004-08-14 14:51:01 +00:00
parent b112d6ed78
commit f9a098efe1

View file

@ -27,7 +27,10 @@ def copyfileobj(fsrc, fdst, length=16*1024):
def _samefile(src, dst): def _samefile(src, dst):
# Macintosh, Unix. # Macintosh, Unix.
if hasattr(os.path,'samefile'): 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. # All other platforms: check for same pathname.
return (os.path.normcase(os.path.abspath(src)) == return (os.path.normcase(os.path.abspath(src)) ==