mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	asyncio: Be careful accessing instance variables in __del__ (closes #21340).
This commit is contained in:
		
							parent
							
								
									ae25f46706
								
							
						
					
					
						commit
						83c1ddda46
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		|  | @ -76,7 +76,9 @@ def gi_code(self): | ||||||
|         return self.gen.gi_code |         return self.gen.gi_code | ||||||
| 
 | 
 | ||||||
|     def __del__(self): |     def __del__(self): | ||||||
|         frame = self.gen.gi_frame |         # Be careful accessing self.gen.frame -- self.gen might not exist. | ||||||
|  |         gen = getattr(self, 'gen', None) | ||||||
|  |         frame = getattr(gen, 'gi_frame', None) | ||||||
|         if frame is not None and frame.f_lasti == -1: |         if frame is not None and frame.f_lasti == -1: | ||||||
|             func = self.func |             func = self.func | ||||||
|             code = func.__code__ |             code = func.__code__ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum