Backed out changeset b9c9691c72c5
Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 86f191d..4e8f74a 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -721,7 +721,8 @@
_asyncio_Future__repr_info_impl(FutureObj *self)
/*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/
{
- return _PyObject_CallArg1(asyncio_future_repr_info_func, self);
+ return PyObject_CallFunctionObjArgs(
+ asyncio_future_repr_info_func, self, NULL);
}
/*[clinic input]
@@ -1536,7 +1537,8 @@
_asyncio_Task__repr_info_impl(TaskObj *self)
/*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/
{
- return _PyObject_CallArg1(asyncio_task_repr_info_func, self);
+ return PyObject_CallFunctionObjArgs(
+ asyncio_task_repr_info_func, self, NULL);
}
/*[clinic input]
@@ -1896,7 +1898,7 @@
return NULL;
}
- PyObject *e = _PyObject_CallArg1(et, msg);
+ PyObject *e = PyObject_CallFunctionObjArgs(et, msg, NULL);
Py_DECREF(msg);
if (e == NULL) {
return NULL;
@@ -1946,7 +1948,7 @@
if (!exc) {
/* exc was not a CancelledError */
- exc = _PyObject_CallNoArg(asyncio_CancelledError);
+ exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL);
if (!exc) {
goto fail;
}
@@ -2179,7 +2181,7 @@
}
/* Check if `result` is a generator */
- o = _PyObject_CallArg1(inspect_isgenerator, result);
+ o = PyObject_CallFunctionObjArgs(inspect_isgenerator, result, NULL);
if (o == NULL) {
/* An exception in inspect.isgenerator */
goto fail;
diff --git a/Modules/_csv.c b/Modules/_csv.c
index 08907db..e5324ae 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -1259,7 +1259,7 @@
(void *) self->rec, self->rec_len);
if (line == NULL)
return NULL;
- result = _PyObject_CallArg1(self->writeline, line);
+ result = PyObject_CallFunctionObjArgs(self->writeline, line, NULL);
Py_DECREF(line);
return result;
}
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index bafcaa5..3837ff1 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -2457,7 +2457,7 @@
PyObject *event = PyTuple_Pack(2, action, node);
if (event == NULL)
return -1;
- res = _PyObject_CallArg1(self->events_append, event);
+ res = PyObject_CallFunctionObjArgs(self->events_append, event, NULL);
Py_DECREF(event);
if (res == NULL)
return -1;
diff --git a/Modules/_json.c b/Modules/_json.c
index da7b2ed..d3dbf98 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -813,14 +813,14 @@
*next_idx_ptr = idx + 1;
if (has_pairs_hook) {
- val = _PyObject_CallArg1(s->object_pairs_hook, rval);
+ val = PyObject_CallFunctionObjArgs(s->object_pairs_hook, rval, NULL);
Py_DECREF(rval);
return val;
}
/* if object_hook is not None: rval = object_hook(rval) */
if (s->object_hook != Py_None) {
- val = _PyObject_CallArg1(s->object_hook, rval);
+ val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL);
Py_DECREF(rval);
return val;
}
@@ -924,7 +924,7 @@
return NULL;
/* rval = parse_constant(constant) */
- rval = _PyObject_CallArg1(s->parse_constant, cstr);
+ rval = PyObject_CallFunctionObjArgs(s->parse_constant, cstr, NULL);
idx += PyUnicode_GET_LENGTH(cstr);
Py_DECREF(cstr);
*next_idx_ptr = idx;
@@ -1023,7 +1023,7 @@
idx - start);
if (numstr == NULL)
return NULL;
- rval = _PyObject_CallArg1(custom_func, numstr);
+ rval = PyObject_CallFunctionObjArgs(custom_func, numstr, NULL);
}
else {
Py_ssize_t i, n;
@@ -1475,7 +1475,7 @@
if (s->fast_encode)
return s->fast_encode(NULL, obj);
else
- return _PyObject_CallArg1(s->encoder, obj);
+ return PyObject_CallFunctionObjArgs(s->encoder, obj, NULL);
}
static int
@@ -1553,7 +1553,7 @@
return -1;
}
}
- newobj = _PyObject_CallArg1(s->defaultfn, obj);
+ newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL);
if (newobj == NULL) {
Py_XDECREF(ident);
return -1;
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 6003476..b198857 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3197,7 +3197,7 @@
PySSL_END_ALLOW_THREADS_S(pw_info->thread_state);
if (pw_info->callable) {
- fn_ret = _PyObject_CallNoArg(pw_info->callable);
+ fn_ret = PyObject_CallFunctionObjArgs(pw_info->callable, NULL);
if (!fn_ret) {
/* TODO: It would be nice to move _ctypes_add_traceback() into the
core python API, so we could use it to add a frame here */
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 4ef5c89..1d7a935 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -2046,7 +2046,7 @@
return s_object;
}
- s_object = _PyObject_CallArg1((PyObject *)(&PyStructType), fmt);
+ s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL);
if (s_object != NULL) {
if (PyDict_Size(cache) >= MAXCACHE)
PyDict_Clear(cache);
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index bf22f29..13d3ccc 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -312,7 +312,7 @@
assert(PyObject_CheckBuffer(obj));
assert(PyList_Check(items) || PyTuple_Check(items));
- structobj = _PyObject_CallArg1(Struct, format);
+ structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
if (structobj == NULL)
return -1;
@@ -406,7 +406,7 @@
if (format == NULL)
goto out;
- structobj = _PyObject_CallArg1(Struct, format);
+ structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
if (structobj == NULL)
goto out;
@@ -620,7 +620,7 @@
if (ndim == 0) {
memcpy(item, ptr, itemsize);
- x = _PyObject_CallArg1(unpack_from, mview);
+ x = PyObject_CallFunctionObjArgs(unpack_from, mview, NULL);
if (x == NULL)
return NULL;
if (PyTuple_GET_SIZE(x) == 1) {
@@ -696,7 +696,7 @@
if (format == NULL)
goto out;
- structobj = _PyObject_CallArg1(Struct, format);
+ structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
Py_DECREF(format);
if (structobj == NULL)
goto out;
@@ -788,7 +788,7 @@
PyObject *tmp;
Py_ssize_t itemsize;
- tmp = _PyObject_CallArg1(calcsize, format);
+ tmp = PyObject_CallFunctionObjArgs(calcsize, format, NULL);
if (tmp == NULL)
return -1;
itemsize = PyLong_AsSsize_t(tmp);
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index a53cf20..754348e 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -709,7 +709,7 @@
assert(callback != NULL);
/* copy-paste of weakrefobject.c's handle_callback() */
- temp = _PyObject_CallArg1(callback, wr);
+ temp = PyObject_CallFunctionObjArgs(callback, wr, NULL);
if (temp == NULL)
PyErr_WriteUnraisable(callback);
else
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 5ea69a0..6bf04cb 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -101,7 +101,7 @@
newkey = newvalue;
Py_INCREF(newvalue);
} else {
- newkey = _PyObject_CallArg1(gbo->keyfunc, newvalue);
+ newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL);
if (newkey == NULL) {
Py_DECREF(newvalue);
return NULL;
@@ -293,7 +293,7 @@
newkey = newvalue;
Py_INCREF(newvalue);
} else {
- newkey = _PyObject_CallArg1(gbo->keyfunc, newvalue);
+ newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL);
if (newkey == NULL) {
Py_DECREF(newvalue);
return NULL;
@@ -1130,7 +1130,7 @@
if (lz->start == 1)
return item;
- good = _PyObject_CallArg1(lz->func, item);
+ good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
if (good == NULL) {
Py_DECREF(item);
return NULL;
@@ -1296,7 +1296,7 @@
if (item == NULL)
return NULL;
- good = _PyObject_CallArg1(lz->func, item);
+ good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
if (good == NULL) {
Py_DECREF(item);
return NULL;
@@ -3824,7 +3824,7 @@
ok = PyObject_IsTrue(item);
} else {
PyObject *good;
- good = _PyObject_CallArg1(lz->func, item);
+ good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
if (good == NULL) {
Py_DECREF(item);
return NULL;
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index e7e34ef..95ea4f7 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -951,7 +951,7 @@
return NULL;
return math_1_to_int(number, ceil, 0);
}
- result = _PyObject_CallNoArg(method);
+ result = PyObject_CallFunctionObjArgs(method, NULL);
Py_DECREF(method);
return result;
}
@@ -991,7 +991,7 @@
return NULL;
return math_1_to_int(number, floor, 0);
}
- result = _PyObject_CallNoArg(method);
+ result = PyObject_CallFunctionObjArgs(method, NULL);
Py_DECREF(method);
return result;
}
@@ -1542,7 +1542,7 @@
Py_TYPE(number)->tp_name);
return NULL;
}
- result = _PyObject_CallNoArg(trunc);
+ result = PyObject_CallFunctionObjArgs(trunc, NULL);
Py_DECREF(trunc);
return result;
}
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 129ff1c..2e9eb9e 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -902,7 +902,7 @@
goto error_exit;
}
- o = to_cleanup = _PyObject_CallNoArg(func);
+ o = to_cleanup = PyObject_CallFunctionObjArgs(func, NULL);
Py_DECREF(func);
if (NULL == o) {
goto error_exit;
@@ -12041,7 +12041,7 @@
Py_TYPE(path)->tp_name);
}
- path_repr = _PyObject_CallNoArg(func);
+ path_repr = PyObject_CallFunctionObjArgs(func, NULL);
Py_DECREF(func);
if (NULL == path_repr) {
return NULL;