mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 07:57:27 +03:00 
			
		
		
		
	Catch BaseException for resource cleanup handlers
In the event of a SystemExit or KeyboardInterrupt, file resources should still be cleaned up before re-raising the exception. https://docs.python.org/3/library/exceptions.html#exception-hierarchy
This commit is contained in:
		
							parent
							
								
									503138c857
								
							
						
					
					
						commit
						51e95f6252
					
				|  | @ -2663,7 +2663,7 @@ def open(fp, mode="r"): | ||||||
|                 # opening failures that are entirely expected. |                 # opening failures that are entirely expected. | ||||||
|                 # logger.debug("", exc_info=True) |                 # logger.debug("", exc_info=True) | ||||||
|                 continue |                 continue | ||||||
|             except Exception: |             except BaseException: | ||||||
|                 if exclusive_fp: |                 if exclusive_fp: | ||||||
|                     fp.close() |                     fp.close() | ||||||
|                 raise |                 raise | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user