[issue41756] Do not always use exceptions to return result from coroutine

Yury Selivanov report at bugs.python.org
Wed Sep 16 16:44:00 EDT 2020


Yury Selivanov <yselivanov at gmail.com> added the comment:

> I think it should be specific to generators and coroutines. Calling `PyObject_CallMethodIdOneArg(coro, &PyId_send, arg);` and interpreting exceptions to emulate the low level API seems a bit too much.

To add to my point: typically higher-level APIs go under the `PyObject_*` namespace, whereas `Py{Type}_*` is more concrete. So I'd make `PyGen_Send` to only work with `PyGen` and `PyCoro`.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41756>
_______________________________________


More information about the Python-bugs-list mailing list