-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-45813: Drop redundant assertion from frame.clear() #29990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check doesn't make sense, @markshannon I very much appreciate it if you find time for the review. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. This assert would be appropriate in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Brilliant idea. Added assertion to |
||
} | ||
(void)frame_tp_clear(f); | ||
Py_RETURN_NONE; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppress printing
RuntimeWarning: coroutine 'CoroutineTest.test_bpo_....<locals>.f' was never awaited
on the console.