mirror of
https://github.com/python/cpython.git
synced 2025-10-19 16:03:42 +00:00
[3.13] gh-131670: Fix crash in anext()
when __anext__
is sync and raises (GH-131682) (#131686)
gh-131670: Fix crash in `anext()` when `__anext__` is sync and raises (GH-131682)
(cherry picked from commit 929afd1d6e
)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
9f36dff788
commit
3492098418
3 changed files with 24 additions and 0 deletions
|
@ -1737,6 +1737,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