mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Improve issue 7835 fix per MAL to handle the case that the
module dictionary has also been cleared.
This commit is contained in:
		
							parent
							
								
									7c29f071d5
								
							
						
					
					
						commit
						031ae6e904
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		|  | @ -145,11 +145,12 @@ def close(self): | |||
|             self.dict.close() | ||||
|         except AttributeError: | ||||
|             pass | ||||
|         # _ClosedDict can be None when close is called from __del__ during shutdown | ||||
|         if _ClosedDict is None: | ||||
|             self.dict = None | ||||
|         else: | ||||
|         # Catch errors that may happen when close is called from __del__ | ||||
|         # because CPython is in interpreter shutdown. | ||||
|         try: | ||||
|             self.dict = _ClosedDict() | ||||
|         except (NameError, TypeError): | ||||
|             self.dict = None | ||||
| 
 | ||||
|     def __del__(self): | ||||
|         if not hasattr(self, 'writeback'): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 R. David Murray
						R. David Murray