]> granicus.if.org Git - python/commit
bpo-37194: Add a new public PyObject_CallNoArgs() function (GH-13890)
authorVictor Stinner <vstinner@redhat.com>
Mon, 17 Jun 2019 12:27:23 +0000 (14:27 +0200)
committerGitHub <noreply@github.com>
Mon, 17 Jun 2019 12:27:23 +0000 (14:27 +0200)
commit2ff58a24e8a1c7e290d025d69ebaea0bbead3b8c
tree85d26a4891196105808df38b430c3332d591da13
parent8bf08ee45b7c2341f0d0175b91892843a37c23da
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.
12 files changed:
Doc/c-api/object.rst
Doc/whatsnew/3.9.rst
Include/abstract.h
Include/cpython/abstract.h
Misc/NEWS.d/next/C API/2019-06-07-14-03-52.bpo-37194.uck7MD.rst [new file with mode: 0644]
Modules/_asynciomodule.c
Modules/_datetimemodule.c
Modules/_elementtree.c
Modules/_pickle.c
Modules/_tkinter.c
Modules/readline.c
Objects/call.c