Avoid inefficient way to call functions without argument

Don't pass "()" format to PyObject_CallXXX() to call a function without
argument: pass NULL as the format string instead. It avoids to have to parse a
string to produce 0 argument.
This commit is contained in:
Victor Stinner 2016-09-05 17:53:15 -07:00
parent ca08301ae0
commit ad8c83ad6b
5 changed files with 11 additions and 11 deletions

View file

@ -2873,7 +2873,7 @@ save_dict(PicklerObject *self, PyObject *obj)
} else {
_Py_IDENTIFIER(items);
items = _PyObject_CallMethodId(obj, &PyId_items, "()");
items = _PyObject_CallMethodId(obj, &PyId_items, NULL);
if (items == NULL)
goto error;
iter = PyObject_GetIter(items);