mirror of
https://github.com/python/cpython.git
synced 2026-05-06 20:51:17 -04:00
gh-126366: Fix crash if __iter__ raises an exception during yield from (#126369)
This commit is contained in:
+3
-2
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user