@@ -5852,24 +5852,6 @@ initialize_locals(PyThreadState *tstate, PyFunctionObject *func,
5852
5852
return -1 ;
5853
5853
}
5854
5854
5855
- static int
5856
- initialize_coro_frame (InterpreterFrame * frame , PyThreadState * tstate ,
5857
- PyFunctionObject * func , PyObject * locals ,
5858
- PyObject * const * args , Py_ssize_t argcount ,
5859
- PyObject * kwnames )
5860
- {
5861
- assert (is_tstate_valid (tstate ));
5862
- assert (func -> func_defaults == NULL || PyTuple_CheckExact (func -> func_defaults ));
5863
- PyCodeObject * code = (PyCodeObject * )func -> func_code ;
5864
- _PyFrame_InitializeSpecials (frame , func , locals , code -> co_nlocalsplus );
5865
- for (int i = 0 ; i < code -> co_nlocalsplus ; i ++ ) {
5866
- frame -> localsplus [i ] = NULL ;
5867
- }
5868
- assert (frame -> frame_obj == NULL );
5869
- return initialize_locals (tstate , func , frame -> localsplus , args , argcount , kwnames );
5870
- }
5871
-
5872
-
5873
5855
/* Consumes all the references to the args */
5874
5856
static PyObject *
5875
5857
make_coro (PyThreadState * tstate , PyFunctionObject * func ,
@@ -5883,12 +5865,17 @@ make_coro(PyThreadState *tstate, PyFunctionObject *func,
5883
5865
return NULL ;
5884
5866
}
5885
5867
InterpreterFrame * frame = (InterpreterFrame * )((PyGenObject * )gen )-> gi_iframe ;
5886
- if (initialize_coro_frame (frame , tstate , func , locals , args , argcount , kwnames )) {
5868
+ PyCodeObject * code = (PyCodeObject * )func -> func_code ;
5869
+ _PyFrame_InitializeSpecials (frame , func , locals , code -> co_nlocalsplus );
5870
+ for (int i = 0 ; i < code -> co_nlocalsplus ; i ++ ) {
5871
+ frame -> localsplus [i ] = NULL ;
5872
+ }
5873
+ ((PyGenObject * )gen )-> gi_frame_valid = 1 ;
5874
+ if (initialize_locals (tstate , func , frame -> localsplus , args , argcount , kwnames )) {
5887
5875
Py_DECREF (gen );
5888
5876
return NULL ;
5889
5877
}
5890
5878
frame -> generator = gen ;
5891
- ((PyGenObject * )gen )-> gi_frame_valid = 1 ;
5892
5879
return gen ;
5893
5880
}
5894
5881
0 commit comments