mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	gh-104374: Remove access to class scopes for inlined comprehensions (#104528)
Co-authored-by: Carl Meyer <carl@oddbird.net>
This commit is contained in:
		
							parent
							
								
									152227b569
								
							
						
					
					
						commit
						662aede68b
					
				
					 3 changed files with 125 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -674,8 +674,9 @@ inline_comprehension(PySTEntryObject *ste, PySTEntryObject *comp,
 | 
			
		|||
                }
 | 
			
		||||
 | 
			
		||||
                // free vars in comprehension that are locals in outer scope can
 | 
			
		||||
                // now simply be locals, unless they are free in comp children
 | 
			
		||||
                if (!is_free_in_any_child(comp, k)) {
 | 
			
		||||
                // now simply be locals, unless they are free in comp children,
 | 
			
		||||
                // or if the outer scope is a class block
 | 
			
		||||
                if (!is_free_in_any_child(comp, k) && ste->ste_type != ClassBlock) {
 | 
			
		||||
                    if (PySet_Discard(comp_free, k) < 0) {
 | 
			
		||||
                        return 0;
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue