mirror of
				https://github.com/python/cpython.git
				synced 2025-11-01 06:01:29 +00:00 
			
		
		
		
	Issue #27078: Added BUILD_STRING opcode. Optimized f-strings evaluation.
This commit is contained in:
		
							parent
							
								
									620bb277f8
								
							
						
					
					
						commit
						ea525a2d1a
					
				
					 14 changed files with 396 additions and 356 deletions
				
			
		|  | @ -2538,6 +2538,24 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) | |||
|             DISPATCH(); | ||||
|         } | ||||
| 
 | ||||
|         TARGET(BUILD_STRING) { | ||||
|             PyObject *str; | ||||
|             PyObject *empty = PyUnicode_New(0, 0); | ||||
|             if (empty == NULL) { | ||||
|                 goto error; | ||||
|             } | ||||
|             str = _PyUnicode_JoinArray(empty, stack_pointer - oparg, oparg); | ||||
|             Py_DECREF(empty); | ||||
|             if (str == NULL) | ||||
|                 goto error; | ||||
|             while (--oparg >= 0) { | ||||
|                 PyObject *item = POP(); | ||||
|                 Py_DECREF(item); | ||||
|             } | ||||
|             PUSH(str); | ||||
|             DISPATCH(); | ||||
|         } | ||||
| 
 | ||||
|         TARGET(BUILD_TUPLE) { | ||||
|             PyObject *tup = PyTuple_New(oparg); | ||||
|             if (tup == NULL) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka