diff options
author | Johannes Gijsbers <jlg@dds.nl> | 2004-08-14 14:51:01 (GMT) |
---|---|---|
committer | Johannes Gijsbers <jlg@dds.nl> | 2004-08-14 14:51:01 (GMT) |
commit | f9a098efe1dcfba59d8bf2026892ee65454c29b6 (patch) | |
tree | 8cc31469770180562ac4361a7cafa448887e7620 | |
parent | b112d6ed78327404d5cb5d3f4ee6ffb7db70d695 (diff) | |
download | cpython-f9a098efe1dcfba59d8bf2026892ee65454c29b6.zip cpython-f9a098efe1dcfba59d8bf2026892ee65454c29b6.tar.gz cpython-f9a098efe1dcfba59d8bf2026892ee65454c29b6.tar.bz2 |
Catch OSError raised when src or dst argument to os.path.samefile doesn't
exist.
-rw-r--r-- | Lib/shutil.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py index d361fa2..43726b4 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -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)) == |