summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorPeter Bierma <zintensitydev@gmail.com>2024-11-05 09:56:36 (GMT)
committerGitHub <noreply@github.com>2024-11-05 09:56:36 (GMT)
commit1371295e678f00a7c89dc5bb2ab61ede9adbc094 (patch)
treefee7c410cf08814dae2d2a7963268862ce0b49a8 /Python/bytecodes.c
parent407c0366d9ccd2a36c6cc8bf92324856b16fd604 (diff)
downloadcpython-1371295e678f00a7c89dc5bb2ab61ede9adbc094.zip
cpython-1371295e678f00a7c89dc5bb2ab61ede9adbc094.tar.gz
cpython-1371295e678f00a7c89dc5bb2ab61ede9adbc094.tar.bz2
gh-126366: Fix crash if `__iter__` raises an exception during `yield from` (#126369)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 81b527e..8c52db6 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -2811,11 +2811,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();
}
}