bpo-31185: Fixed miscellaneous errors in asyncio speedup module. by serhiy-storchaka · Pull Request #3076 · python/cpython (original) (raw)

(nits) While method calling API with PyID is not exported by DLL, static variable can be used.

static PyObject *call_exception_handler = NULL;
if (!call_exception_handler) {
    call_exception_handler = PyUnicode_InternFromString("call_exception_handler");
    if (!call_exception_handler) {
        goto finally;
    }
}

PyObject *res = PyObject_CallMethodObjArgs(task->task_loop, call_exception_handler, context, NULL);

This may be able to avoid creating temporary unbound method object.