8000 GH-100762: Don't call `gen.throw()` in `gen.close()`, unless necessary. by markshannon · Pull Request #101013 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-100762: Don't call gen.throw() in gen.close(), unless necessary. #101013

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 7 commits into from
Jan 24, 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
Prev Previous commit
Next Next commit
Don't skip throwing if sub-generator raises.
  • Loading branch information
markshannon committed Jan 13, 2023
commit 044f2cf07c97386a0de8b10bf8419cf54dad13eb
2 changes: 1 addition & 1 deletion Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ gen_close(PyGenObject *gen, PyObject *args)
_PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
/* It is possible for the previous instruction to not be a
* YIELD_VALUE if the debugger has changed the lineno. */
if (frame->prev_instr->opcode == YIELD_VALUE) {
if (err == 0 && frame->prev_instr->opcode == YIELD_VALUE) {
assert(frame->prev_instr[1].opcode == RESUME);
int exception_handler_depth = frame->prev_instr->oparg;
assert(exception_handler_depth > 0);
Expand Down
0