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:
Andrew Svetlov 2019-09-17 15:59:49 +03:00 committed by Miss Islington (bot)
parent 5f5f11faf9
commit c275312a62
3 changed files with 25 additions and 5 deletions

View file

@ -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;