Vladimir Matveev <desco...@gmail.com> added the comment:
Also should it be specific to generators/coroutines and accept PyGenObject* or should it try to handle multiple cases and expose the result for them in uniform way, i.e. ``` if (PyGen_CheckExact(gen) || PyCoro_CheckExact(gen)) { // use coroutine/generator specific code that avoids raising exceptions *result = ... return PYGEN_RETURN; } PyObject *ret; if (arg == Py_None) { ret = Py_TYPE(gen)->tp_iternext(gen); } else { ret = _PyObject_CallMethodIdOneArg(coro, &PyId_send, arg); } if (ret != NULL) { *result = ret; return PYGEN_YIELD; } if (_PyGen_FetchStopIterationValue(result) == 0) { return PYGEN_RETURN; } return PYGEN_ERROR; ``` ---------- _______________________________________ 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