| 258 | } |
| 259 | |
| 260 | bool PyEventLoop::AsyncHandle::cancelled() { |
| 261 | // https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.Handle.cancelled |
| 262 | PyObject *ret = PyObject_CallMethod(_handle, "cancelled", NULL); // returns Python bool |
| 263 | bool cancelled = ret == Py_True; |
| 264 | Py_XDECREF(ret); |
| 265 | return cancelled; |
| 266 | } |
| 267 | |
| 268 | bool PyEventLoop::AsyncHandle::_finishedOrCancelled() { |
| 269 | PyObject *scheduled = PyObject_GetAttrString(_handle, "_scheduled"); // this attribute only exists on asyncio.TimerHandle returned by loop.call_later |