bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 86178a7..db1c306 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2221,7 +2221,7 @@
PyObject *it, *result, *meth_output;
assert(o != NULL);
- meth_output = _PyObject_CallMethodId(o, meth_id, NULL);
+ meth_output = _PyObject_CallMethodIdNoArgs(o, meth_id);
if (meth_output == NULL || PyList_CheckExact(meth_output)) {
return meth_output;
}
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index 99855d8..edce250 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1019,28 +1019,28 @@
mappingproxy_keys(mappingproxyobject *pp, PyObject *Py_UNUSED(ignored))
{
_Py_IDENTIFIER(keys);
- return _PyObject_CallMethodId(pp->mapping, &PyId_keys, NULL);
+ return _PyObject_CallMethodIdNoArgs(pp->mapping, &PyId_keys);
}
static PyObject *
mappingproxy_values(mappingproxyobject *pp, PyObject *Py_UNUSED(ignored))
{
_Py_IDENTIFIER(values);
- return _PyObject_CallMethodId(pp->mapping, &PyId_values, NULL);
+ return _PyObject_CallMethodIdNoArgs(pp->mapping, &PyId_values);
}
static PyObject *
mappingproxy_items(mappingproxyobject *pp, PyObject *Py_UNUSED(ignored))
{
_Py_IDENTIFIER(items);
- return _PyObject_CallMethodId(pp->mapping, &PyId_items, NULL);
+ return _PyObject_CallMethodIdNoArgs(pp->mapping, &PyId_items);
}
static PyObject *
mappingproxy_copy(mappingproxyobject *pp, PyObject *Py_UNUSED(ignored))
{
_Py_IDENTIFIER(copy);
- return _PyObject_CallMethodId(pp->mapping, &PyId_copy, NULL);
+ return _PyObject_CallMethodIdNoArgs(pp->mapping, &PyId_copy);
}
/* WARNING: mappingproxy methods must not give access
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index a21e490..0faf7e7 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -61,7 +61,7 @@
}
if (n <= 0) {
- result = _PyObject_CallMethodIdObjArgs(f, &PyId_readline, NULL);
+ result = _PyObject_CallMethodIdNoArgs(f, &PyId_readline);
}
else {
result = _PyObject_CallMethodId(f, &PyId_readline, "i", n);
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index 4c9ae3b..dfbd30a 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -920,7 +920,7 @@
if (args == NULL)
goto Done;
- items = _PyObject_CallMethodIdObjArgs((PyObject *)od, &PyId_items, NULL);
+ items = _PyObject_CallMethodIdNoArgs((PyObject *)od, &PyId_items);
if (items == NULL)
goto Done;
@@ -1421,8 +1421,8 @@
Py_SIZE(pieces) = count;
}
else {
- PyObject *items = _PyObject_CallMethodIdObjArgs((PyObject *)self,
- &PyId_items, NULL);
+ PyObject *items = _PyObject_CallMethodIdNoArgs((PyObject *)self,
+ &PyId_items);
if (items == NULL)
goto Done;
pieces = PySequence_List(items);
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 3b9a537..96021ee 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -4425,7 +4425,7 @@
PyObject *items;
_Py_IDENTIFIER(items);
- items = _PyObject_CallMethodIdObjArgs(obj, &PyId_items, NULL);
+ items = _PyObject_CallMethodIdNoArgs(obj, &PyId_items);
if (items == NULL) {
Py_CLEAR(*listitems);
return -1;
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index ae3f6dc..e8a429a 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -455,7 +455,7 @@
method(PyObject *proxy, PyObject *Py_UNUSED(ignored)) { \
_Py_IDENTIFIER(special); \
UNWRAP(proxy); \
- return _PyObject_CallMethodId(proxy, &PyId_##special, NULL); \
+ return _PyObject_CallMethodIdNoArgs(proxy, &PyId_##special); \
}