mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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:
parent
ca08301ae0
commit
ad8c83ad6b
5 changed files with 11 additions and 11 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue