Catch OSError raised when src or dst argument to os.path.samefile doesn't
exist.
This commit is contained in:
parent
b112d6ed78
commit
f9a098efe1
|
@ -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)) ==
|
||||||
|
|
Loading…
Reference in New Issue