@@ -5854,24 +5854,6 @@ initialize_locals(PyThreadState *tstate, PyFunctionObject *func,
58545854 return -1 ;
58555855}
58565856
5857- static int
5858- initialize_coro_frame (InterpreterFrame * frame , PyThreadState * tstate ,
5859- PyFunctionObject * func , PyObject * locals ,
5860- PyObject * const * args , Py_ssize_t argcount ,
5861- PyObject * kwnames )
5862- {
5863- assert (is_tstate_valid (tstate ));
5864- assert (func -> func_defaults == NULL || PyTuple_CheckExact (func -> func_defaults ));
5865- PyCodeObject * code = (PyCodeObject * )func -> func_code ;
5866- _PyFrame_InitializeSpecials (frame , func , locals , code -> co_nlocalsplus );
5867- for (int i = 0 ; i < code -> co_nlocalsplus ; i ++ ) {
5868- frame -> localsplus [i ] = NULL ;
5869- }
5870- assert (frame -> frame_obj == NULL );
5871- return initialize_locals (tstate , func , frame -> localsplus , args , argcount , kwnames );
5872- }
5873-
5874-
58755857/* Consumes all the references to the args */
58765858static PyObject *
58775859make_coro (PyThreadState * tstate , PyFunctionObject * func ,
@@ -5885,12 +5867,17 @@ make_coro(PyThreadState *tstate, PyFunctionObject *func,
58855867 return NULL ;
58865868 }
58875869 InterpreterFrame * frame = (InterpreterFrame * )((PyGenObject * )gen )-> gi_iframe ;
5888- if (initialize_coro_frame (frame , tstate , func , locals , args , argcount , kwnames )) {
5870+ PyCodeObject * code = (PyCodeObject * )func -> func_code ;
5871+ _PyFrame_InitializeSpecials (frame , func , locals , code -> co_nlocalsplus );
5872+ for (int i = 0 ; i < code -> co_nlocalsplus ; i ++ ) {
5873+ frame -> localsplus [i ] = NULL ;
5874+ }
5875+ ((PyGenObject * )gen )-> gi_frame_valid = 1 ;
5876+ if (initialize_locals (tstate , func , frame -> localsplus , args , argcount , kwnames )) {
58895877 Py_DECREF (gen );
58905878 return NULL ;
58915879 }
58925880 frame -> generator = gen ;
5893- ((PyGenObject * )gen )-> gi_frame_valid = 1 ;
58945881 return gen ;
58955882}
58965883
0 commit comments