summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2021-12-08 16:05:00 (GMT)
committerGitHub <noreply@github.com>2021-12-08 16:05:00 (GMT)
commitd4363d214097b3fca8b7910c2e0e91c8b0873fb2 (patch)
treeaff0f7c8b09418b5c4451be8a58c6073d5ac13df /Objects
parent69806b9516dbe092381f3ef884c7c64bb9b8414a (diff)
downloadcpython-d4363d214097b3fca8b7910c2e0e91c8b0873fb2.zip
cpython-d4363d214097b3fca8b7910c2e0e91c8b0873fb2.tar.gz
cpython-d4363d214097b3fca8b7910c2e0e91c8b0873fb2.tar.bz2
bpo-45813: Drop redundant assertion from frame.clear() (GH-29990)
* bpo-45813: Drop redundant assertion from frame.clear() * Move assertion to frame_dealloc()
Diffstat (limited to 'Objects')
-rw-r--r--Objects/frameobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 926a32a..2197e07 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -613,6 +613,10 @@ static PyGetSetDef frame_getsetlist[] = {
static void
frame_dealloc(PyFrameObject *f)
{
+ /* It is the responsibility of the owning generator/coroutine
+ * to have cleared the generator pointer */
+ assert(f->f_frame->generator == NULL);
+
if (_PyObject_GC_IS_TRACKED(f)) {
_PyObject_GC_UNTRACK(f);
}
@@ -686,7 +690,6 @@ frame_clear(PyFrameObject *f, PyObject *Py_UNUSED(ignored))
}
if (f->f_frame->generator) {
_PyGen_Finalize(f->f_frame->generator);
- assert(f->f_frame->generator == NULL);
}
(void)frame_tp_clear(f);
Py_RETURN_NONE;