From 5352cc41fa4eb5f0dc847709392e88473b8593b0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 17 Jun 2019 17:15:36 +0200 Subject: [PATCH] bpo-37194: Add PyObject_CallNoArgs() rationale (GH-14159) 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 e4787ad39c..13f13b3489 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 c5cb626a1b..3da8b1685b 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 -- 2.40.0