This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients Mark.Shannon, lukasz.langa, scoder, serhiy.storchaka, v2m, vstinner, yselivanov
Date 2020-09-11.10:57:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1599821831.3.0.0576839485154.issue41756@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-09-11 10:57:11scodersetrecipients: + scoder, vstinner, lukasz.langa, Mark.Shannon, serhiy.storchaka, yselivanov, v2m
2020-09-11 10:57:11scodersetmessageid: <1599821831.3.0.0576839485154.issue41756@roundup.psfhosted.org>
2020-09-11 10:57:11scoderlinkissue41756 messages
2020-09-11 10:57:11scodercreate