Skip to content

Commit d05be32

Browse files
[3.14] gh-141004: Document Py_LOCAL and Py_LOCAL_INLINE (GH-141725) (GH-141761)
gh-141004: Document `Py_LOCAL` and `Py_LOCAL_INLINE` (GH-141725) (cherry picked from commit 3149d64) Co-authored-by: Stan Ulbrych <[email protected]>
1 parent b7c25ea commit d05be32

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
@@ -171,6 +171,17 @@ complete listing.
171171
Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the
172172
command line (see :c:member:`PyConfig.use_environment`).
173173

174+
.. c:macro:: Py_LOCAL(type)
175+
176+
Declare a function returning the specified *type* using a fast-calling
177+
qualifier for functions that are local to the current file.
178+
Semantically, this is equivalent to ``static type``.
179+
180+
.. c:macro:: Py_LOCAL_INLINE(type)
181+
182+
Equivalent to :c:macro:`Py_LOCAL` but additionally requests the function
183+
be inlined.
184+
174185
.. c:macro:: Py_MAX(x, y)
175186
176187
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)