From 9ecab4050bcefdc3b0bef70a05b7565d610509c8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 17 Jun 2019 15:26:11 +0200 Subject: [PATCH] bpo-37194: Add PyObject_CallNoArgs() rationale Explain in the doc why PyObject_CallNoArgs() should be preferred over other existing ways to call a function without any arguments. --- Doc/c-api/object.rst | 3 ++- Doc/whatsnew/3.9.rst | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst index e4787ad39c080a..13f13b3489b81f 100644 --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -255,7 +255,8 @@ Object Protocol .. c:function:: PyObject* PyObject_CallNoArgs(PyObject *callable) - Call a callable Python object *callable* without any arguments. + Call a callable Python object *callable* without any arguments. It is the + most efficient way to call a callable Python object without any argument. Return the result of the call on success, or raise an exception and return *NULL* on failure. diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 62b013f7721c46..278df86cb3426c 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -103,7 +103,10 @@ Build and C API Changes ======================= * Add a new public :c:func:`PyObject_CallNoArgs` function to the C API: - call a callable Python object without any arguments. + call a callable Python object without any arguments. It is the most efficient + way to call a callable Python object without any argument. + (Contributed by Victor Stinner in :issue:`37194`.) + Deprecated