10000 gh-100762: Fix optimization in gen_close by iritkatriel · Pull Request #111069 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-100762: Fix optimization in gen_close #111069

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

Merged
merged 6 commits into from
Oct 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-100762: fix refleak in gen_close
  • Loading branch information
iritkatriel committed Oct 19, 2023
commit 084c91a29f6a439257e2add2717040b54a7a5823
3 changes: 2 additions & 1 deletion Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ static PyObject *
gen_close(PyGenObject *gen, PyObject *args)
{
PyObject *retval;
PyObject *yf = _PyGen_yf(gen);
int err = 0;

if (gen->gi_frame_state == FRAME_CREATED) {
Expand All @@ -388,6 +387,8 @@ gen_close(PyGenObject *gen, PyObject *args)
if (gen->gi_frame_state >= FRAME_COMPLETED) {
Py_RETURN_NONE;
}

PyObject *yf = _PyGen_yf(gen);
if (yf) {
PyFrameState state = gen->gi_frame_state;
gen->gi_frame_state = FRAME_EXECUTING;
Expand Down
0