Issue #28858: Remove _PyObject_CallArg1() macro
Replace
_PyObject_CallArg1(func, arg)
with
PyObject_CallFunctionObjArgs(func, arg, NULL)
Using the _PyObject_CallArg1() macro increases the usage of the C stack, which
was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have this
issue.
diff --git a/Objects/abstract.c b/Objects/abstract.c
index beb12c9..a6a58db 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2496,7 +2496,7 @@
assert(args != NULL);
if (!PyTuple_Check(args)) {
- result = _PyObject_CallArg1(callable, args);
+ result = PyObject_CallFunctionObjArgs(callable, args, NULL);
}
else {
result = PyObject_Call(callable, args, NULL);
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 32f8a89..fcdb5fd 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -146,7 +146,7 @@
Py_DECREF(writer);
return -1;
}
- result = _PyObject_CallArg1(writer, value);
+ result = PyObject_CallFunctionObjArgs(writer, value, NULL);
Py_DECREF(value);
Py_DECREF(writer);
if (result == NULL)
diff --git a/Objects/genobject.c b/Objects/genobject.c
index bd7873b..59f53ce 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -1341,7 +1341,7 @@
PyObject *res;
Py_INCREF(firstiter);
- res = _PyObject_CallArg1(firstiter, o);
+ res = PyObject_CallFunctionObjArgs(firstiter, o, NULL);
Py_DECREF(firstiter);
if (res == NULL) {
return 1;
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 0af1534..d9699ef 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5873,7 +5873,7 @@
goto error;
}
- retval = _PyObject_CallArg1(func, ival);
+ retval = PyObject_CallFunctionObjArgs(func, ival, NULL);
Py_DECREF(func);
Py_DECREF(ival);
return retval;
@@ -5914,7 +5914,7 @@
return -1;
}
if (func != NULL) {
- res = _PyObject_CallArg1(func, value);
+ res = PyObject_CallFunctionObjArgs(func, value, NULL);
Py_DECREF(func);
if (res != NULL) {
result = PyObject_IsTrue(res);
@@ -6284,7 +6284,7 @@
PyErr_Clear();
Py_RETURN_NOTIMPLEMENTED;
}
- res = _PyObject_CallArg1(func, other);
+ res = PyObject_CallFunctionObjArgs(func, other, NULL);
Py_DECREF(func);
return res;
}