mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-131670: Fix crash in anext()
when __anext__
is sync and raises (#131682)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
5fef4ff9ed
commit
929afd1d6e
3 changed files with 24 additions and 0 deletions
|
@ -1837,6 +1837,9 @@ builtin_anext_impl(PyObject *module, PyObject *aiterator,
|
|||
}
|
||||
|
||||
awaitable = (*t->tp_as_async->am_anext)(aiterator);
|
||||
if (awaitable == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (default_value == NULL) {
|
||||
return awaitable;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue