Skip to content

Commit 49ac2bb

Browse files
[3.13] gh-141004: Document Py_LOCAL and Py_LOCAL_INLINE (GH-141725) (GH-141762)
gh-141004: Document `Py_LOCAL` and `Py_LOCAL_INLINE` (GH-141725) (cherry picked from commit 3149d64) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent a0cbdd8 commit 49ac2bb

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Doc/c-api/intro.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@ complete listing.
183183
Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the
184184
command line (see :c:member:`PyConfig.use_environment`).
185185

186+
.. c:macro:: Py_LOCAL(type)
187+
188+
Declare a function returning the specified *type* using a fast-calling
189+
qualifier for functions that are local to the current file.
190+
Semantically, this is equivalent to ``static type``.
191+
192+
.. c:macro:: Py_LOCAL_INLINE(type)
193+
194+
Equivalent to :c:macro:`Py_LOCAL` but additionally requests the function
195+
be inlined.
196+
186197
.. c:macro:: Py_MAX(x, y)
187198
188199
Return the maximum value between ``x`` and ``y``.

Doc/whatsnew/2.5.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,9 +2169,9 @@ Changes to Python's build process and to the C API include:
21692169

21702170
* Two new macros can be used to indicate C functions that are local to the
21712171
current file so that a faster calling convention can be used.
2172-
``Py_LOCAL(type)`` declares the function as returning a value of the
2172+
:c:macro:`Py_LOCAL` declares the function as returning a value of the
21732173
specified *type* and uses a fast-calling qualifier.
2174-
``Py_LOCAL_INLINE(type)`` does the same thing and also requests the
2174+
:c:macro:`Py_LOCAL_INLINE` does the same thing and also requests the
21752175
function be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined before
21762176
:file:`python.h` is included, a set of more aggressive optimizations are enabled
21772177
for the module; you should benchmark the results to find out if these

0 commit comments

Comments
 (0)