mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	GH-131798: Type-propagate string/list/tuple slices (GH-134671)
This commit is contained in:
		
							parent
							
								
									ac9c3431cc
								
							
						
					
					
						commit
						8fdbbf8b18
					
				
					 4 changed files with 55 additions and 3 deletions
				
			
		
							
								
								
									
										13
									
								
								Python/optimizer_cases.c.h
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										13
									
								
								Python/optimizer_cases.c.h
									
										
									
										generated
									
									
									
								
							|  | @ -568,8 +568,19 @@ | |||
|         } | ||||
| 
 | ||||
|         case _BINARY_SLICE: { | ||||
|             JitOptSymbol *container; | ||||
|             JitOptSymbol *res; | ||||
|             res = sym_new_not_null(ctx); | ||||
|             container = stack_pointer[-3]; | ||||
|             PyTypeObject *type = sym_get_type(container); | ||||
|             if (type == &PyUnicode_Type || | ||||
|                 type == &PyList_Type || | ||||
|                 type == &PyTuple_Type) | ||||
|             { | ||||
|                 res = sym_new_type(ctx, type); | ||||
|             } | ||||
|             else { | ||||
|                 res = sym_new_not_null(ctx); | ||||
|             } | ||||
|             stack_pointer[-3] = res; | ||||
|             stack_pointer += -2; | ||||
|             assert(WITHIN_STACK_BOUNDS()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Amit Lavon
						Amit Lavon