Stefan Behnel <stefan...@behnel.de> added the comment:

Copying some of the design discussion from the PR here 
(https://github.com/python/cpython/pull/22196/files#r486730457), because it 
belongs into the ticket.

Yury Selivanov proposed to add a new C-API function for this (naming changes by 
me):

    typedef enum {PYGEN_RETURN, PYGEN_ERROR, PYGEN_NEXT} PyGenSendStatus;

    PyGenSendStatus PyGen_Send(PyGenObject *gen, PyObject *arg, PyObject 
**result);

Mark Shannon and I agreed that the status code should be the return value, with 
some confusion whether "PyGen_" or "PyCoro_" would be appropriate prefixes.

Mark Shannon wrote: I don't think [the C-API function] should be public, as a 
possible further improvement is to stop passing exceptions through a side 
channel, but in result. Maybe we don't want to do that, but lets' not add to 
the (already rather large) C-API.

However, I think this will be demanded and used by extensions, including Cython 
implemented ones, so it seems better to make them use a public function than a 
private one.

Let's continue these lines of discussion here.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41756>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to