mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
bpo-38013: make async_generator_athrow object tolerant to throwing exceptions (GH-16070)
Even when the helper is not started yet. This behavior follows conventional generator one. There is no reason for `async_generator_athrow` to handle `gen.throw()` differently. https://bugs.python.org/issue38013
This commit is contained in:
parent
5f5f11faf9
commit
c275312a62
3 changed files with 25 additions and 5 deletions
|
@ -1884,11 +1884,6 @@ async_gen_athrow_throw(PyAsyncGenAThrow *o, PyObject *args)
|
|||
{
|
||||
PyObject *retval;
|
||||
|
||||
if (o->agt_state == AWAITABLE_STATE_INIT) {
|
||||
PyErr_SetString(PyExc_RuntimeError, NON_INIT_CORO_MSG);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (o->agt_state == AWAITABLE_STATE_CLOSED) {
|
||||
PyErr_SetNone(PyExc_StopIteration);
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue