@@ -1810,25 +1810,28 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func,
18101810{
18111811 bool has_dict = (kwargs != NULL && PyDict_GET_SIZE (kwargs ) > 0 );
18121812 PyObject * kwnames = NULL ;
1813- PyObject * const * newargs ;
1814- PyObject * stack_array [8 ];
1813+ _PyStackRef * newargs ;
1814+ PyObject * const * object_array ;
1815+ _PyStackRef stack_array [8 ];
18151816 if (has_dict ) {
1816- newargs = _PyStack_UnpackDict (tstate , _PyTuple_ITEMS (callargs ), nargs , kwargs , & kwnames );
1817- if (newargs == NULL ) {
1817+ object_array = _PyStack_UnpackDict (tstate , _PyTuple_ITEMS (callargs ), nargs , kwargs , & kwnames );
1818+ if (object_array == NULL ) {
18181819 PyStackRef_CLOSE (func );
18191820 goto error ;
18201821 }
18211822 size_t total_args = nargs + PyDict_GET_SIZE (kwargs );
1823+ assert (sizeof (PyObject * ) == sizeof (_PyStackRef ));
1824+ newargs = (_PyStackRef * )object_array ;
18221825 for (size_t i = 0 ; i < total_args ; i ++ ) {
1823- (( _PyStackRef * ) newargs ) [i ] = PyStackRef_FromPyObjectSteal (newargs [i ]);
1826+ newargs [i ] = PyStackRef_FromPyObjectSteal (object_array [i ]);
18241827 }
18251828 }
18261829 else {
18271830 if (nargs <= 8 ) {
18281831 newargs = stack_array ;
18291832 }
18301833 else {
1831- newargs = PyMem_Malloc (sizeof (PyObject * ) * nargs );
1834+ newargs = PyMem_Malloc (sizeof (_PyStackRef ) * nargs );
18321835 if (newargs == NULL ) {
18331836 PyErr_NoMemory ();
18341837 PyStackRef_CLOSE (func );
@@ -1837,15 +1840,15 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func,
18371840 }
18381841 /* We need to create a new reference for all our args since the new frame steals them. */
18391842 for (Py_ssize_t i = 0 ; i < nargs ; i ++ ) {
1840- (( _PyStackRef * ) newargs ) [i ] = PyStackRef_FromPyObjectNew (PyTuple_GET_ITEM (callargs , i ));
1843+ newargs [i ] = PyStackRef_FromPyObjectNew (PyTuple_GET_ITEM (callargs , i ));
18411844 }
18421845 }
18431846 _PyInterpreterFrame * new_frame = _PyEvalFramePushAndInit (
18441847 tstate , func , locals ,
1845- ( _PyStackRef const * ) newargs , nargs , kwnames , previous
1848+ newargs , nargs , kwnames , previous
18461849 );
18471850 if (has_dict ) {
1848- _PyStack_UnpackDict_FreeNoDecRef (newargs , kwnames );
1851+ _PyStack_UnpackDict_FreeNoDecRef (object_array , kwnames );
18491852 }
18501853 else if (nargs > 8 ) {
18511854 PyMem_Free ((void * )newargs );
0 commit comments