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 v2m
Recipients Mark.Shannon, lukasz.langa, scoder, serhiy.storchaka, v2m, yselivanov
Date 2020-09-28.17:38:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601314701.25.0.193924013357.issue41756@roundup.psfhosted.org>
In-reply-to
Content
No, I don't think so but I can definitely make one. A few questions first:
- having PySendResult as a result type of PyIterSend seems ok, however prefix for each concrete value (PYGEN_*) is not aligned with the prefix of the function itself (PyIter_)
- should it also deal with tstate->c_tracefunc (probably not) or just be something like
```
PySendResult
PyIter_Send(PyObject *iter, PyObject *arg, PyObject **result)
{
    _Py_IDENTIFIER(send);
    assert(result != NULL);

    if (PyGen_CheckExact(iter) || PyCoro_CheckExact(iter)) {
        return PyGen_Send((PyGenObject *)iter, arg, result);
    }

    if (arg == Py_None && Py_TYPE(iter)->tp_iternext != NULL) {
        *result = Py_TYPE(iter)->tp_iternext(iter);
    }
    else {
        *result = _PyObject_CallMethodIdOneArg(iter, &PyId_send, arg);
    }

    if (*result == NULL) {
        if (_PyGen_FetchStopIterationValue(result) == 0) {
            return PYGEN_RETURN;
        }
        return PYGEN_ERROR;
    }
    return PYGEN_NEXT;
}
```
History
Date User Action Args
2020-09-28 17:38:21v2msetrecipients: + v2m, scoder, lukasz.langa, Mark.Shannon, serhiy.storchaka, yselivanov
2020-09-28 17:38:21v2msetmessageid: <1601314701.25.0.193924013357.issue41756@roundup.psfhosted.org>
2020-09-28 17:38:21v2mlinkissue41756 messages
2020-09-28 17:38:20v2mcreate