mirror of
https://github.com/python/cpython
synced 2026-09-29 10:35:30 +03:00
bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)
This commit is contained in:
parent
38f44b4a4a
commit
762f93ff2e
37 changed files with 154 additions and 132 deletions
|
|
@ -2221,7 +2221,7 @@ method_output_as_list(PyObject *o, _Py_Identifier *meth_id)
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1019,28 +1019,28 @@ static PyObject *
|
|||
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
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ PyFile_GetLine(PyObject *f, int n)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -920,7 +920,7 @@ odict_reduce(register PyODictObject *od, PyObject *Py_UNUSED(ignored))
|
|||
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 @@ odict_repr(PyODictObject *self)
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -4425,7 +4425,7 @@ _PyObject_GetItemsIter(PyObject *obj, PyObject **listitems,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ proxy_checkref(PyWeakReference *proxy)
|
|||
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); \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue