return prev_task;
}
-static int
-is_loop_running(PyObject *loop)
-{
- PyObject *func = PyObject_GetAttr(loop, &_Py_ID(is_running));
- if (func == NULL) {
- PyErr_Format(PyExc_TypeError, "Loop missing is_running()");
- return -1;
- }
- PyObject *res = PyObject_CallNoArgs(func);
- int retval = Py_IsTrue(res);
- Py_DECREF(func);
- Py_DECREF(res);
- return !!retval;
-}
-
/* ----- Task */
/*[clinic input]
}
if (eager_start) {
- int loop_running = is_loop_running(self->task_loop);
- if (loop_running == -1) {
+ PyObject *res = PyObject_CallMethodNoArgs(loop, &_Py_ID(is_running));
+ if (res == NULL) {
return -1;
}
- if (loop_running) {
+ int is_loop_running = Py_IsTrue(res);
+ Py_DECREF(res);
+ if (is_loop_running) {
if (task_eager_start(state, self)) {
return -1;
}