Skip to content

Commit f14744f

Browse files
[3.14] gh-141004: Document missing pyport.h macros (GH-159719) (GH-159796)
(cherry picked from commit 4c34b7e)
1 parent 22a6215 commit f14744f

4 files changed

Lines changed: 18 additions & 9 deletions

File tree

‎Doc/c-api/float.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ Pack functions
210210
The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an
211211
:c:expr:`int` argument, non-zero if you want the bytes string in little-endian
212212
format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` and ``p+7``), zero if you
213-
want big-endian format (exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN`
214-
constant can be used to use the native endian: it is equal to ``1`` on big
215-
endian processor, or ``0`` on little endian processor.
213+
want big-endian format (exponent first, at *p*). Use the :c:macro:`PY_LITTLE_ENDIAN`
214+
constant to select the native endian: it is equal to ``0`` on big
215+
endian processor, or ``1`` on little endian processor.
216216
217217
Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set,
218218
most likely :exc:`OverflowError`).
@@ -241,8 +241,8 @@ Unpack functions
241241
The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an
242242
:c:expr:`int` argument, non-zero if the bytes string is in little-endian format
243243
(exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if big-endian
244-
(exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN` constant can be used to
245-
use the native endian: it is equal to ``1`` on big endian processor, or ``0``
244+
(exponent first, at *p*). Use the :c:macro:`PY_LITTLE_ENDIAN` constant to
245+
select the native endian: it is equal to ``0`` on big endian processor, or ``1``
246246
on little endian processor.
247247
248248
Return value: The unpacked double. On error, this is ``-1.0`` and

‎Doc/c-api/intro.rst‎

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

262+
.. c:macro:: PY_BIG_ENDIAN
263+
PY_LITTLE_ENDIAN
264+
265+
Constants describing the byte order of the platform that Python was built
266+
for. Exactly one of them is ``1`` and the other is ``0``.
267+
262268

263269
Assertion utilities
264270
^^^^^^^^^^^^^^^^^^^
@@ -820,8 +826,13 @@ use them.
820826
821827
A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``.
822828
C99 doesn't define such a thing directly (size_t is an unsigned integral type).
823-
See :pep:`353` for details. ``PY_SSIZE_T_MAX`` is the largest positive value
824-
of type :c:type:`Py_ssize_t`.
829+
See :pep:`353` for details.
830+
831+
.. c:macro:: PY_SSIZE_T_MAX
832+
PY_SSIZE_T_MIN
833+
834+
The limit values (largest positive one and smallest negative one,
835+
respecitvely) of type :c:type:`Py_ssize_t`.
825836

826837

827838
.. _api-exceptions:

‎Doc/tools/.nitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# as tested on the CI via check-warnings.py in reusable-docs.yml.
33
# Keep lines sorted lexicographically to help avoid merge conflicts.
44

5-
Doc/c-api/float.rst
65
Doc/c-api/module.rst
76
Doc/library/ast.rst
87
Doc/library/asyncio-extending.rst

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ PY_DWORD_MAX
3131
PY_FORMAT_SIZE_T
3232
PY_INT32_T
3333
PY_INT64_T
34-
PY_LITTLE_ENDIAN
3534
PY_LLONG_MAX
3635
PY_LLONG_MIN
3736
PY_LONG_LONG

0 commit comments

Comments
 (0)