File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1648,7 +1648,9 @@ static PyObject *
16481648methodcaller_vectorcall (
16491649 methodcallerobject * mc , PyObject * const * args , size_t nargsf , PyObject * kwnames )
16501650{
1651- if (!_PyArg_CheckPositional ("methodcaller" , PyVectorcall_NARGS (nargsf ), 1 , 1 )
1651+ Py_ssize_t number_of_arguments = PyVectorcall_NARGS (nargsf );
1652+
1653+ if (!_PyArg_CheckPositional ("methodcaller" , number_of_arguments , 1 , 1 )
16521654 || !_PyArg_NoKwnames ("methodcaller" , kwnames )) {
16531655 return NULL ;
16541656 }
@@ -1659,11 +1661,16 @@ methodcaller_vectorcall(
16591661 }
16601662
16611663 assert (mc -> vectorcall_args != 0 );
1662- mc -> vectorcall_args [0 ] = args [0 ];
1664+ number_of_arguments ++ ;
1665+ PyObject * * tmp_args = (PyObject * * ) PyMem_Malloc (number_of_arguments * sizeof (PyObject * ));
1666+ memcpy (tmp_args , mc -> vectorcall_args , sizeof (PyObject * ) * number_of_arguments );
1667+ tmp_args [0 ] = args [0 ];
16631668 return PyObject_VectorcallMethod (
1664- mc -> name , mc -> vectorcall_args ,
1669+ mc -> name , tmp_args ,
16651670 (PyTuple_GET_SIZE (mc -> xargs )) | PY_VECTORCALL_ARGUMENTS_OFFSET ,
16661671 mc -> vectorcall_kwnames );
1672+
1673+ PyMem_Free (tmp_args );
16671674}
16681675#endif
16691676
You can’t perform that action at this time.
0 commit comments