summaryrefslogtreecommitdiffstats
path: root/Objects/iterobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/iterobject.c')
-rw-r--r--Objects/iterobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index 135ced9..ebb342f 100644
--- a/Objects/iterobject.c
+++ b/Objects/iterobject.c
@@ -384,6 +384,7 @@ anextawaitable_iternext(anextawaitableobject *obj)
return result;
}
if (PyErr_ExceptionMatches(PyExc_StopAsyncIteration)) {
+ PyErr_Clear();
_PyGen_SetStopIterationValue(obj->default_value);
}
return NULL;
@@ -407,6 +408,7 @@ anextawaitable_proxy(anextawaitableobject *obj, char *meth, PyObject *arg) {
* exception we replace it with a `StopIteration(default)`, as if
* it was the return value of `__anext__()` coroutine.
*/
+ PyErr_Clear();
_PyGen_SetStopIterationValue(obj->default_value);
}
return NULL;