mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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.
This commit is contained in:
parent
d8185ca43e
commit
5560b7492c
1 changed files with 1 additions and 16 deletions
|
@ -1615,22 +1615,7 @@ PyMapping_HasKey(PyObject *o, PyObject *key)
|
|||
PyObject *
|
||||
PyObject_CallObject(PyObject *o, PyObject *a)
|
||||
{
|
||||
PyObject *r;
|
||||
PyObject *args = a;
|
||||
|
||||
if (args == NULL) {
|
||||
args = PyTuple_New(0);
|
||||
if (args == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
r = PyEval_CallObject(o, args);
|
||||
|
||||
if (args != a) {
|
||||
Py_DECREF(args);
|
||||
}
|
||||
|
||||
return r;
|
||||
return PyEval_CallObjectWithKeywords(o, a, NULL);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue