8000 gh-126366: Fix crash if `__iter__` raises an exception during `yield from` by ZeroIntensity · Pull Request #126369 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-126366: Fix crash if __iter__ raises an exception during yield from #126369

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 5 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
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
Propagate errors for generic iterables in GET_YIELD_FROM_ITER
  • Loading branch information
ZeroIntensity committed Nov 3, 2024
commit 529853358ce8e5cc94b1a6e02d034704a5cae13f
5 changes: 3 additions & 2 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2791,11 +2791,12 @@ dummy_func(
}
else {
/* `iterable` is not a generator. */
iter = PyStackRef_FromPyObjectSteal(PyObject_GetIter(iterable_o));
PyObject *iter_o = PyObject_GetIter(iterable_o);
DEAD(iterable);
if (PyStackRef_IsNull(iter)) {
if (iter_o == NULL) {
ERROR_NO_POP();
}
iter = PyStackRef_FromPyObjectSteal(iter_o);
DECREF_INPUTS();
}
}
Expand Down
5 changes: 3 additions & 2 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0