File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -1741,12 +1741,7 @@ clear_gen_frame(PyThreadState *tstate, _PyInterpreterFrame * frame)
17411741{
17421742 assert (frame -> owner == FRAME_OWNED_BY_GENERATOR );
17431743 PyGenObject * gen = _PyGen_GetGeneratorFromFrame (frame );
1744- /* It's safe to assume that the generator is locked, because this
1745- * was eventually called by something that locked it already.
1746- *
1747- * In fact, trying to lock the generator here ends up breaking
1748- * the critical section API. */
1749- _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (gen );
1744+ Py_BEGIN_CRITICAL_SECTION (gen );
17501745 gen -> gi_frame_state = FRAME_CLEARED ;
17511746 assert (tstate -> exc_info == & gen -> gi_exc_state );
17521747 tstate -> exc_info = gen -> gi_exc_state .previous_item ;
@@ -1757,6 +1752,7 @@ clear_gen_frame(PyThreadState *tstate, _PyInterpreterFrame * frame)
17571752 _PyErr_ClearExcState (& gen -> gi_exc_state );
17581753 tstate -> c_recursion_remaining ++ ;
17591754 frame -> previous = NULL ;
1755+ Py_END_CRITICAL_SECTION ();
17601756}
17611757
17621758void
You can’t perform that action at this time.
0 commit comments