Skip to content

Commit 97540a0

Browse files
[3.15] gh-141004: Document missing pyport.h macros (GH-159719) (GH-159795)
(cherry picked from commit 4c34b7e) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
1 parent 81fe70e commit 97540a0

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎Doc/c-api/float.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Pack functions
214214
The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an
215215
:c:expr:`int` argument, non-zero if you want the bytes string in little-endian
216216
format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` and ``p+7``), zero if you
217-
want big-endian format (exponent first, at *p*). Use the :c:macro:`!PY_LITTLE_ENDIAN`
217+
want big-endian format (exponent first, at *p*). Use the :c:macro:`PY_LITTLE_ENDIAN`
218218
constant to select the native endian: it is equal to ``0`` on big
219219
endian processor, or ``1`` on little endian processor.
220220
@@ -240,7 +240,7 @@ Unpack functions
240240
The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an
241241
:c:expr:`int` argument, non-zero if the bytes string is in little-endian format
242242
(exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if big-endian
243-
(exponent first, at *p*). Use the :c:macro:`!PY_LITTLE_ENDIAN` constant to
243+
(exponent first, at *p*). Use the :c:macro:`PY_LITTLE_ENDIAN` constant to
244244
select the native endian: it is equal to ``0`` on big endian processor, or ``1``
245245
on little endian processor.
246246

‎Doc/c-api/intro.rst‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ Numeric utilities
299299
Argument must be a character or an integer in the range [-128, 127] or [0,
300300
255]. This macro returns ``c`` cast to an ``unsigned char``.
301301

302+
.. c:macro:: PY_BIG_ENDIAN
303+
PY_LITTLE_ENDIAN
304+
305+
Constants describing the byte order of the platform that Python was built
306+
for. Exactly one of them is ``1`` and the other is ``0``.
307+
302308

303309
Assertion utilities
304310
^^^^^^^^^^^^^^^^^^^
@@ -916,8 +922,13 @@ use them.
916922
917923
A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``.
918924
C99 doesn't define such a thing directly (size_t is an unsigned integral type).
919-
See :pep:`353` for details. ``PY_SSIZE_T_MAX`` is the largest positive value
920-
of type :c:type:`Py_ssize_t`.
925+
See :pep:`353` for details.
926+
927+
.. c:macro:: PY_SSIZE_T_MAX
928+
PY_SSIZE_T_MIN
929+
930+
The limit values (largest positive one and smallest negative one,
931+
respecitvely) of type :c:type:`Py_ssize_t`.
921932

922933

923934
.. _api-exceptions:

‎Tools/check-c-api-docs/ignored_c_api.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ PyExpat_CAPSULE_NAME
2626
# pyport.h
2727
PYLONG_BITS_IN_DIGIT
2828
PY_DWORD_MAX
29-
PY_BIG_ENDIAN
3029
# cpython/methodobject.h
3130
PyCFunction_GET_CLASS
3231
# cpython/descrobject.h

0 commit comments

Comments
 (0)