Skip to content

Commit 5352cc4

Browse files
authored
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.
1 parent 1b8a46d commit 5352cc4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎Doc/c-api/object.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ Object Protocol
255255
256256
.. c:function:: PyObject* PyObject_CallNoArgs(PyObject *callable)
257257
258-
Call a callable Python object *callable* without any arguments.
258+
Call a callable Python object *callable* without any arguments. It is the
259+
most efficient way to call a callable Python object without any argument.
259260
260261
Return the result of the call on success, or raise an exception and return
261262
*NULL* on failure.

‎Doc/whatsnew/3.9.rst‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ Build and C API Changes
103103
=======================
104104

105105
* Add a new public :c:func:`PyObject_CallNoArgs` function to the C API:
106-
call a callable Python object without any arguments.
106+
call a callable Python object without any arguments. It is the most efficient
107+
way to call a callable Python object without any argument.
108+
(Contributed by Victor Stinner in :issue:`37194`.)
109+
107110

108111

109112
Deprecated

0 commit comments

Comments
 (0)