mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-44771: Sync with importlib_resources 5.2.2, fixing refleak. (#27497)
* bpo-44771: Sync with importlib_resources 5.2.2, fixing refleak. * Include new 'resources' dir in the Makefile.
This commit is contained in:
		
							parent
							
								
									48a62559df
								
							
						
					
					
						commit
						e63e6311aa
					
				
					 2 changed files with 6 additions and 3 deletions
				
			
		|  | @ -87,14 +87,16 @@ def _tempfile(reader, suffix=''): | |||
|     # properly. | ||||
|     fd, raw_path = tempfile.mkstemp(suffix=suffix) | ||||
|     try: | ||||
|         os.write(fd, reader()) | ||||
|         os.close(fd) | ||||
|         try: | ||||
|             os.write(fd, reader()) | ||||
|         finally: | ||||
|             os.close(fd) | ||||
|         del reader | ||||
|         yield pathlib.Path(raw_path) | ||||
|     finally: | ||||
|         try: | ||||
|             os.remove(raw_path) | ||||
|         except (FileNotFoundError, PermissionError): | ||||
|         except FileNotFoundError: | ||||
|             pass | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jason R. Coombs
						Jason R. Coombs