Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef enum {
PyObject_HEAD \
PyObject *prefix##_loop; \
PyObject *prefix##_callback0; \
PyContext *prefix##_context0; \
PyObject *prefix##_context0; \
PyObject *prefix##_callbacks; \
PyObject *prefix##_exception; \
PyObject *prefix##_result; \
Expand All @@ -81,7 +81,7 @@ typedef struct {
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;
Expand Down Expand Up @@ -340,7 +340,7 @@ get_event_loop(void)


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];
Expand Down Expand Up @@ -451,7 +451,7 @@ future_schedule_callbacks(FutureObj *fut)
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);
Expand Down Expand Up @@ -619,7 +619,7 @@ future_get_result(FutureObj *fut, PyObject **result)
}

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");
Expand Down Expand Up @@ -906,16 +906,15 @@ _asyncio_Future_add_done_callback_impl(FutureObj *self, PyObject *fn,
/*[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]
Expand Down
6 changes: 3 additions & 3 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ incr_false(void)
}


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. */
Expand Down Expand Up @@ -1500,7 +1500,7 @@ init_current_context(void)
}
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;
Expand Down Expand Up @@ -1561,7 +1561,7 @@ PyDec_SetCurrentContext(PyObject *self UNUSED, PyObject *v)
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;
Expand Down