summaryrefslogtreecommitdiff
path: root/Modules/_asynciomodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_asynciomodule.c')
-rw-r--r--Modules/_asynciomodule.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index fff90468a5..ceac7f0039 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -118,8 +118,8 @@ future_schedule_callbacks(FutureObj *fut)
PyObject *handle = NULL;
PyObject *cb = PyList_GET_ITEM(iters, i);
- handle = _PyObject_CallMethodId(
- fut->fut_loop, &PyId_call_soon, "OO", cb, fut, NULL);
+ handle = _PyObject_CallMethodIdObjArgs(fut->fut_loop, &PyId_call_soon,
+ cb, fut, NULL);
if (handle == NULL) {
Py_DECREF(iters);
@@ -141,7 +141,7 @@ future_init(FutureObj *fut, PyObject *loop)
_Py_IDENTIFIER(get_debug);
if (loop == NULL || loop == Py_None) {
- loop = PyObject_CallObject(asyncio_get_event_loop, NULL);
+ loop = _PyObject_CallNoArg(asyncio_get_event_loop);
if (loop == NULL) {
return -1;
}
@@ -158,7 +158,7 @@ future_init(FutureObj *fut, PyObject *loop)
}
if (PyObject_IsTrue(res)) {
Py_CLEAR(res);
- fut->fut_source_tb = PyObject_CallObject(traceback_extract_stack, NULL);
+ fut->fut_source_tb = _PyObject_CallNoArg(traceback_extract_stack);
if (fut->fut_source_tb == NULL) {
return -1;
}
@@ -204,7 +204,7 @@ future_set_exception(FutureObj *fut, PyObject *exc)
}
if (PyExceptionClass_Check(exc)) {
- exc_val = PyObject_CallObject(exc, NULL);
+ exc_val = _PyObject_CallNoArg(exc);
if (exc_val == NULL) {
return NULL;
}
@@ -257,7 +257,7 @@ future_get_result(FutureObj *fut, PyObject **result)
return -1;
}
- exc = _PyObject_CallArg1(asyncio_InvalidStateError, msg);
+ exc = PyObject_CallFunctionObjArgs(asyncio_InvalidStateError, msg, NULL);
Py_DECREF(msg);
if (exc == NULL) {
return -1;
@@ -283,8 +283,9 @@ static PyObject *
future_add_done_callback(FutureObj *fut, PyObject *arg)
{
if (fut->fut_state != STATE_PENDING) {
- PyObject *handle = _PyObject_CallMethodId(
- fut->fut_loop, &PyId_call_soon, "OO", arg, fut, NULL);
+ PyObject *handle = _PyObject_CallMethodIdObjArgs(fut->fut_loop,
+ &PyId_call_soon,
+ arg, fut, NULL);
if (handle == NULL) {
return NULL;
@@ -835,7 +836,7 @@ FutureObj_finalize(FutureObj *fut)
func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler);
if (func != NULL) {
- res = _PyObject_CallArg1(func, context);
+ res = PyObject_CallFunctionObjArgs(func, context, NULL);
if (res == NULL) {
PyErr_WriteUnraisable(func);
}
@@ -1429,7 +1430,7 @@ _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop)
PyObject *res;
if (loop == NULL) {
- loop = PyObject_CallObject(asyncio_get_event_loop, NULL);
+ loop = _PyObject_CallNoArg(asyncio_get_event_loop);
if (loop == NULL) {
return NULL;
}
@@ -1514,7 +1515,7 @@ _asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop)
PyObject *res;
if (loop == NULL) {
- loop = PyObject_CallObject(asyncio_get_event_loop, NULL);
+ loop = _PyObject_CallNoArg(asyncio_get_event_loop);
if (loop == NULL) {
return NULL;
}
@@ -1731,7 +1732,7 @@ TaskObj_finalize(TaskObj *task)
func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler);
if (func != NULL) {
- res = _PyObject_CallArg1(func, context);
+ res = PyObject_CallFunctionObjArgs(func, context, NULL);
if (res == NULL) {
PyErr_WriteUnraisable(func);
}
@@ -1948,7 +1949,7 @@ task_step_impl(TaskObj *task, PyObject *exc)
if (!exc) {
/* exc was not a CancelledError */
- exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL);
+ exc = _PyObject_CallNoArg(asyncio_CancelledError);
if (!exc) {
goto fail;
}
@@ -1965,13 +1966,13 @@ task_step_impl(TaskObj *task, PyObject *exc)
result = _PyGen_Send((PyGenObject*)coro, Py_None);
}
else {
- result = _PyObject_CallMethodIdObjArgs(
- coro, &PyId_send, Py_None, NULL);
+ result = _PyObject_CallMethodIdObjArgs(coro, &PyId_send,
+ Py_None, NULL);
}
}
else {
- result = _PyObject_CallMethodIdObjArgs(
- coro, &PyId_throw, exc, NULL);
+ result = _PyObject_CallMethodIdObjArgs(coro, &PyId_throw,
+ exc, NULL);
if (clear_exc) {
/* We created 'exc' during this call */
Py_CLEAR(exc);
@@ -2388,7 +2389,7 @@ module_init(void)
WITH_MOD("weakref")
GET_MOD_ATTR(cls, "WeakSet")
- all_tasks = PyObject_CallObject(cls, NULL);
+ all_tasks = _PyObject_CallNoArg(cls);
Py_CLEAR(cls);
if (all_tasks == NULL) {
goto fail;