File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ Release date: TBA
10
10
Core and Builtins
11
11
-----------------
12
12
13
+ - Issue #27812: Properly clear out a generator's frame's backreference to the
14
+ generator to prevent crashes in frame.clear().
15
+
13
16
- Issue #27811: Fix a crash when a coroutine that has not been awaited is
14
17
finalized with warnings-as-errors enabled.
15
18
Original file line number Diff line number Diff line change @@ -71,7 +71,10 @@ gen_dealloc(PyGenObject *gen)
71
71
return ; /* resurrected. :( */
72
72
73
73
_PyObject_GC_UNTRACK (self );
74
- Py_CLEAR (gen -> gi_frame );
74
+ if (gen -> gi_frame != NULL ) {
75
+ gen -> gi_frame -> f_gen = NULL ;
76
+ Py_CLEAR (gen -> gi_frame );
77
+ }
75
78
Py_CLEAR (gen -> gi_code );
76
79
Py_CLEAR (gen -> gi_name );
77
80
Py_CLEAR (gen -> gi_qualname );
You can’t perform that action at this time.
0 commit comments