bpo-37483: add _PyObject_CallOneArg() function (#14558)
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 4caf3a4..443acc5 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -141,8 +141,7 @@
Do this check after 'future_init()'; in case we need to raise
an error, __del__ needs a properly initialized object.
*/
- PyObject *res = PyObject_CallFunctionObjArgs(
- asyncio_iscoroutine_func, coro, NULL);
+ PyObject *res = _PyObject_CallOneArg(asyncio_iscoroutine_func, coro);
if (res == NULL) {
return -1;
}
@@ -1286,8 +1285,7 @@
_asyncio_Future__repr_info_impl(FutureObj *self)
/*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/
{
- return PyObject_CallFunctionObjArgs(
- asyncio_future_repr_info_func, self, NULL);
+ return _PyObject_CallOneArg(asyncio_future_repr_info_func, (PyObject *)self);
}
static PyObject *
@@ -1364,7 +1362,7 @@
func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler);
if (func != NULL) {
- PyObject *res = PyObject_CallFunctionObjArgs(func, context, NULL);
+ PyObject *res = _PyObject_CallOneArg(func, context);
if (res == NULL) {
PyErr_WriteUnraisable(func);
}
@@ -2104,13 +2102,13 @@
Py_DECREF(current_task_func);
return NULL;
}
- ret = PyObject_CallFunctionObjArgs(current_task_func, loop, NULL);
+ ret = _PyObject_CallOneArg(current_task_func, loop);
Py_DECREF(current_task_func);
Py_DECREF(loop);
return ret;
}
else {
- ret = PyObject_CallFunctionObjArgs(current_task_func, loop, NULL);
+ ret = _PyObject_CallOneArg(current_task_func, loop);
Py_DECREF(current_task_func);
return ret;
}
@@ -2146,7 +2144,7 @@
return NULL;
}
- res = PyObject_CallFunctionObjArgs(all_tasks_func, loop, NULL);
+ res = _PyObject_CallOneArg(all_tasks_func, loop);
Py_DECREF(all_tasks_func);
return res;
}
@@ -2159,8 +2157,7 @@
_asyncio_Task__repr_info_impl(TaskObj *self)
/*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/
{
- return PyObject_CallFunctionObjArgs(
- asyncio_task_repr_info_func, self, NULL);
+ return _PyObject_CallOneArg(asyncio_task_repr_info_func, (PyObject *)self);
}
/*[clinic input]
@@ -2411,7 +2408,7 @@
func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler);
if (func != NULL) {
- PyObject *res = PyObject_CallFunctionObjArgs(func, context, NULL);
+ PyObject *res = _PyObject_CallOneArg(func, context);
if (res == NULL) {
PyErr_WriteUnraisable(func);
}
@@ -2543,7 +2540,7 @@
return NULL;
}
- PyObject *e = PyObject_CallFunctionObjArgs(et, msg, NULL);
+ PyObject *e = _PyObject_CallOneArg(et, msg);
Py_DECREF(msg);
if (e == NULL) {
return NULL;