File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -366,8 +366,8 @@ is_resume(_Py_CODEUNIT *instr)
366366 );
367367}
368368
369- PyObject *
370- _PyGen_yf (PyGenObject * gen )
369+ static PyObject *
370+ _PyGen_yf_lock_held (PyGenObject * gen )
371371{
372372 if (gen -> gi_frame_state == FRAME_SUSPENDED_YIELD_FROM ) {
373373 _PyInterpreterFrame * frame = & gen -> gi_iframe ;
@@ -379,8 +379,18 @@ _PyGen_yf(PyGenObject *gen)
379379 return NULL ;
380380}
381381
382+ PyObject *
383+ _PyGen_yf (PyGenObject * gen )
384+ {
385+ PyObject * res ;
386+ Py_BEGIN_CRITICAL_SECTION (gen );
387+ res = _PyGen_yf_lock_held (gen );
388+ Py_END_CRITICAL_SECTION ();
389+ return res ;
390+ }
391+
382392static PyObject *
383- gen_close (PyObject * self , PyObject * args )
393+ gen_close_lock_held (PyObject * self , PyObject * args )
384394{
385395 PyGenObject * gen = _PyGen_CAST (self );
386396
@@ -446,7 +456,6 @@ gen_close(PyObject *self, PyObject *args)
446456 return NULL ;
447457}
448458
449-
450459PyDoc_STRVAR (throw_doc ,
451460"throw(value)\n\
452461throw(type[,value[,tb]])\n\
You can’t perform that action at this time.
0 commit comments