Skip to content

Commit 5298533

Browse files
committed
Propagate errors for generic iterables in GET_YIELD_FROM_ITER
1 parent ac556a2 commit 5298533

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

Python/bytecodes.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,11 +2791,12 @@ dummy_func(
27912791
}
27922792
else {
27932793
/* `iterable` is not a generator. */
2794-
iter = PyStackRef_FromPyObjectSteal(PyObject_GetIter(iterable_o));
2794+
PyObject *iter_o = PyObject_GetIter(iterable_o);
27952795
DEAD(iterable);
2796-
if (PyStackRef_IsNull(iter)) {
2796+
if (iter_o == NULL) {
27972797
ERROR_NO_POP();
27982798
}
2799+
iter = PyStackRef_FromPyObjectSteal(iter_o);
27992800
DECREF_INPUTS();
28002801
}
28012802
}

Python/executor_cases.c.h

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)