mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	Issue #26802: Optimized calling a function with *args only positional arguments.
Patch by Joe Jevnik.
This commit is contained in:
		
							parent
							
								
									5bfe0da808
								
							
						
					
					
						commit
						79d6e8de9e
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		|  | @ -4890,6 +4890,21 @@ update_star_args(int nstack, int nstar, PyObject *stararg, | ||||||
| { | { | ||||||
|     PyObject *callargs, *w; |     PyObject *callargs, *w; | ||||||
| 
 | 
 | ||||||
|  |     if (!nstack) { | ||||||
|  |         if (!stararg) { | ||||||
|  |             /* There are no positional arguments on the stack and there is no
 | ||||||
|  |                sequence to be unpacked. */ | ||||||
|  |             return PyTuple_New(0); | ||||||
|  |         } | ||||||
|  |         if (PyTuple_CheckExact(stararg)) { | ||||||
|  |             /* No arguments are passed on the stack and the sequence is not a
 | ||||||
|  |                tuple subclass so we can just pass the stararg tuple directly | ||||||
|  |                to the function. */ | ||||||
|  |             Py_INCREF(stararg); | ||||||
|  |             return stararg; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     callargs = PyTuple_New(nstack + nstar); |     callargs = PyTuple_New(nstack + nstar); | ||||||
|     if (callargs == NULL) { |     if (callargs == NULL) { | ||||||
|         return NULL; |         return NULL; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka