From fe5e1ca7a7a829e72e8caa4772567b43ae27d8fb Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Tue, 18 Nov 2025 18:01:46 +0000 Subject: [PATCH 1/2] Commit --- Doc/c-api/intro.rst | 10 ++++++++++ Doc/whatsnew/2.5.rst | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst index bace21b7981091..2b1f6593b9b6e6 100644 --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -171,6 +171,16 @@ complete listing. Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the command line (see :c:member:`PyConfig.use_environment`). +.. c:macro:: Py_LOCAL(type) + + Declare a function returning the specified *type* using a fast-calling + qualifier for functions that are local to the current file. + +.. c:macro:: Py_LOCAL_INLINE(type) + + Equivalent to :c:macro:`Py_LOCAL` but additionally requests the function + be inlined. + .. c:macro:: Py_MAX(x, y) Return the maximum value between ``x`` and ``y``. diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst index 3430ac8668e280..e195d9d462dda9 100644 --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -2169,9 +2169,9 @@ Changes to Python's build process and to the C API include: * Two new macros can be used to indicate C functions that are local to the current file so that a faster calling convention can be used. - ``Py_LOCAL(type)`` declares the function as returning a value of the + :c:macro:`Py_LOCAL` declares the function as returning a value of the specified *type* and uses a fast-calling qualifier. - ``Py_LOCAL_INLINE(type)`` does the same thing and also requests the + :c:macro:`Py_LOCAL_INLINE` does the same thing and also requests the function be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined before :file:`python.h` is included, a set of more aggressive optimizations are enabled for the module; you should benchmark the results to find out if these From 3e70322159e945c80bb8ff61c327a9ec0f1426aa Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Wed, 19 Nov 2025 16:21:23 +0000 Subject: [PATCH 2/2] Apply suggestion from Peter --- Doc/c-api/intro.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst index 2b1f6593b9b6e6..c39e006f059d30 100644 --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -175,6 +175,7 @@ complete listing. Declare a function returning the specified *type* using a fast-calling qualifier for functions that are local to the current file. + Semantically, this is equivalent to ``static type``. .. c:macro:: Py_LOCAL_INLINE(type)