mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Catch OSError raised when src or dst argument to os.path.samefile doesn't
exist.
This commit is contained in:
		
							parent
							
								
									b112d6ed78
								
							
						
					
					
						commit
						f9a098efe1
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		|  | @ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Johannes Gijsbers
						Johannes Gijsbers