summaryrefslogtreecommitdiff
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-17 14:27:23 +0200
committerGitHub <noreply@github.com>2019-06-17 14:27:23 +0200
commit2ff58a24e8a1c7e290d025d69ebaea0bbead3b8c (patch)
tree85d26a4891196105808df38b430c3332d591da13 /Modules/_pickle.c
parent8bf08ee45b7c2341f0d0175b91892843a37c23da (diff)
downloadcpython-git-2ff58a24e8a1c7e290d025d69ebaea0bbead3b8c.tar.gz
bpo-37194: Add a new public PyObject_CallNoArgs() function (GH-13890)
Add a new public PyObject_CallNoArgs() function to the C API: call a callable Python object without any arguments. It is the most efficient way to call a callback without any argument. On x86-64, for example, PyObject_CallFunctionObjArgs(func, NULL) allocates 960 bytes on the stack per call, whereas PyObject_CallNoArgs(func) only allocates 624 bytes per call. It is excluded from stable ABI 3.8. Replace private _PyObject_CallNoArg() with public PyObject_CallNoArgs() in C extensions: _asyncio, _datetime, _elementtree, _pickle, _tkinter and readline.
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r--Modules/_pickle.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 34e11bd5f8..3adece0f00 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -1274,7 +1274,7 @@ _Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
return -1;
if (n == READ_WHOLE_LINE) {
- data = _PyObject_CallNoArg(self->readline);
+ data = PyObject_CallNoArgs(self->readline);
}
else {
PyObject *len;
@@ -4411,7 +4411,7 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
/* Check for a __reduce__ method. */
reduce_func = _PyObject_GetAttrId(obj, &PyId___reduce__);
if (reduce_func != NULL) {
- reduce_value = _PyObject_CallNoArg(reduce_func);
+ reduce_value = PyObject_CallNoArgs(reduce_func);
}
else {
PyErr_Format(st->PicklingError,