From: Johannes Gijsbers Date: Sat, 14 Aug 2004 14:51:01 +0000 (+0000) Subject: Catch OSError raised when src or dst argument to os.path.samefile doesn't X-Git-Tag: v2.4a3~249 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f9a098efe1dcfba59d8bf2026892ee65454c29b6;p=python Catch OSError raised when src or dst argument to os.path.samefile doesn't exist. --- diff --git a/Lib/shutil.py b/Lib/shutil.py index d361fa2b5d..43726b4736 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)) ==