File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1741,7 +1741,12 @@ clear_gen_frame(PyThreadState *tstate, _PyInterpreterFrame * frame)
17411741{
17421742 assert (frame -> owner == FRAME_OWNED_BY_GENERATOR );
17431743 PyGenObject * gen = _PyGen_GetGeneratorFromFrame (frame );
1744- Py_BEGIN_CRITICAL_SECTION (gen );
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 );
17451750 gen -> gi_frame_state = FRAME_CLEARED ;
17461751 assert (tstate -> exc_info == & gen -> gi_exc_state );
17471752 tstate -> exc_info = gen -> gi_exc_state .previous_item ;
@@ -1752,7 +1757,6 @@ clear_gen_frame(PyThreadState *tstate, _PyInterpreterFrame * frame)
17521757 _PyErr_ClearExcState (& gen -> gi_exc_state );
17531758 tstate -> c_recursion_remaining ++ ;
17541759 frame -> previous = NULL ;
1755- Py_END_CRITICAL_SECTION ();
17561760}
17571761
17581762void
You can’t perform that action at this time.
0 commit comments