Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5560b74

Browse files
committed
PyObject_CallObject(): this may as well call PyEval_CallObject()
directly, as the only thing done here (replace NULL args with an empty tuple) is also done there. XXX Maybe we should take one step further and equate the two at the macro level? That's harder though because PyEval_Call* is declared in a header that's not included standard. But it is silly that PyObject_CallObject calls PyEval_CallObject which calls back to PyObject_Call. Maybe PyEval_CallObject should be moved into this file instead? All I know is that there are too many call APIs! The differences between PyObject_Call and PyEval_CallObjectWithKeywords is that the latter allows args to be NULL, and does explicit type checks for args and kwds.
1 parent d8185ca commit 5560b74

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

Objects/abstract.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,22 +1615,7 @@ PyMapping_HasKey(PyObject *o, PyObject *key)
16151615
PyObject *
16161616
PyObject_CallObject(PyObject *o, PyObject *a)
16171617
{
1618-
PyObject *r;
1619-
PyObject *args = a;
1620-
1621-
if (args == NULL) {
1622-
args = PyTuple_New(0);
1623-
if (args == NULL)
1624-
return NULL;
1625-
}
1626-
1627-
r = PyEval_CallObject(o, args);
1628-
1629-
if (args != a) {
1630-
Py_DECREF(args);
1631-
}
1632-
1633-
return r;
1618+
return PyEval_CallObjectWithKeywords(o, a, NULL);
16341619
}
16351620

16361621
PyObject *

0 commit comments

Comments
 (0)