PyObject_HEAD \
PyObject *prefix##_loop; \
PyObject *prefix##_callback0; \
- PyContext *prefix##_context0; \
+ PyObject *prefix##_context0; \
PyObject *prefix##_callbacks; \
PyObject *prefix##_exception; \
PyObject *prefix##_result; \
PyObject *task_fut_waiter;
PyObject *task_coro;
PyObject *task_name;
- PyContext *task_context;
+ PyObject *task_context;
int task_must_cancel;
int task_log_destroy_pending;
} TaskObj;
static int
-call_soon(PyObject *loop, PyObject *func, PyObject *arg, PyContext *ctx)
+call_soon(PyObject *loop, PyObject *func, PyObject *arg, PyObject *ctx)
{
PyObject *handle;
PyObject *stack[3];
PyObject *cb = PyTuple_GET_ITEM(cb_tup, 0);
PyObject *ctx = PyTuple_GET_ITEM(cb_tup, 1);
- if (call_soon(fut->fut_loop, cb, (PyObject *)fut, (PyContext *)ctx)) {
+ if (call_soon(fut->fut_loop, cb, (PyObject *)fut, ctx)) {
/* If an error occurs in pure-Python implementation,
all callbacks are cleared. */
Py_CLEAR(fut->fut_callbacks);
}
static PyObject *
-future_add_done_callback(FutureObj *fut, PyObject *arg, PyContext *ctx)
+future_add_done_callback(FutureObj *fut, PyObject *arg, PyObject *ctx)
{
if (!future_is_alive(fut)) {
PyErr_SetString(PyExc_RuntimeError, "uninitialized Future object");
/*[clinic end generated code: output=7ce635bbc9554c1e input=15ab0693a96e9533]*/
{
if (context == NULL) {
- context = (PyObject *)PyContext_CopyCurrent();
+ context = PyContext_CopyCurrent();
if (context == NULL) {
return NULL;
}
- PyObject *res = future_add_done_callback(
- self, fn, (PyContext *)context);
+ PyObject *res = future_add_done_callback(self, fn, context);
Py_DECREF(context);
return res;
}
- return future_add_done_callback(self, fn, (PyContext *)context);
+ return future_add_done_callback(self, fn, context);
}
/*[clinic input]
}
-static PyContextVar *current_context_var;
+static PyObject *current_context_var;
/* Template for creating new thread contexts, calling Context() without
* arguments and initializing the module_context on first access. */
}
CTX(tl_context)->status = 0;
- PyContextToken *tok = PyContextVar_Set(current_context_var, tl_context);
+ PyObject *tok = PyContextVar_Set(current_context_var, tl_context);
if (tok == NULL) {
Py_DECREF(tl_context);
return NULL;
Py_INCREF(v);
}
- PyContextToken *tok = PyContextVar_Set(current_context_var, v);
+ PyObject *tok = PyContextVar_Set(current_context_var, v);
Py_DECREF(v);
if (tok == NULL) {
return NULL;