mirror of
				https://github.com/python/cpython.git
				synced 2025-10-25 18:54:53 +00:00 
			
		
		
		
	call_function(): document PyMethod optimization
This commit is contained in:
		
							parent
							
								
									213cc388c7
								
							
						
					
					
						commit
						b69ee8c386
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		|  | @ -4736,7 +4736,11 @@ call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames) | |||
|     } | ||||
|     else { | ||||
|         if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) { | ||||
|             /* optimize access to bound methods */ | ||||
|             /* Optimize access to bound methods. Reuse the Python stack
 | ||||
|                to pass 'self' as the first argument, replace 'func' | ||||
|                with 'self'. It avoids the creation of a new temporary tuple | ||||
|                for arguments (to replace func with self) when the method uses | ||||
|                FASTCALL. */ | ||||
|             PyObject *self = PyMethod_GET_SELF(func); | ||||
|             Py_INCREF(self); | ||||
|             func = PyMethod_GET_FUNCTION(func); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner