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

Yury Selivanov report at bugs.python.org
Mon Sep 21 14:36:08 EDT 2020


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

> If you disagree with me, please say why, don't just merge the PR.

Apologies, Mark. I didn't intend to merge something bypassing your opinion; just missed your comment between reviewing multiple PRs in a few unrelated repos. I'm sorry.

On the actual naming subject, you proposed:

> `PySendResult PyIter_Send(PyObject *obj, PyObject *arg, PyObject **result);`

The problem with using this name is that ideally we should also support non-native coroutine and generator implementations (i.e. resolve the "send" attribute and call it using Python calling convention). Ideally we should have two C APIs: one low-level supporting only native objects and a high level one, supporting all kinds of them.

Can we perhaps add both `PyGen_Send()` and `PyCoro_Send()` for now that would only accept generators and coroutines respectively? After that we can discuss adding a more generic `PyIter_Send`?


> Would you revert the PR, please.

Since this is in 3.10/master that nobody uses right now except us (Python core devs), can we just issue a follow up PR to fix whatever is there to fix? I'd like to avoid the churn of reverting, and again, I apologize for pushing this a bit hastily.  Let me know if you actually want a revert and I'll do that.

----------

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


More information about the Python-bugs-list mailing list