Skip to content

Commit 033bd65

Browse files
committed
Update documentation from PEP 757
Remove doc from the header file, only keep doc in Doc/c-api/long.rst to avoid the documentation to be outdated in one place.
1 parent 816798d commit 033bd65

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

Doc/c-api/long.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ Export API
724724
725725
.. c:member:: uint8_t negative
726726
727-
1 if the number is negative, 0 otherwise.
727+
``1`` if the number is negative, ``0`` otherwise.
728728
Only valid if :c:member:`digits` is not ``NULL``.
729729
730730
.. c:member:: Py_ssize_t ndigits
@@ -741,11 +741,11 @@ Export API
741741
742742
Export a Python :class:`int` object.
743743
744-
On success, set *\*export_long* and return 0.
745-
On error, set an exception and return -1.
744+
On success, set *\*export_long* and return ``0``.
745+
On error, set an exception and return ``-1``.
746746
747-
If *export_long.digits* is not ``NULL``, :c:func:`PyLong_FreeExport` must be
748-
called when the export is no longer needed.
747+
If *export_long->digits* is not ``NULL``, :c:func:`PyLong_FreeExport` must
748+
be called when the export is no longer needed.
749749
750750
751751
.. c:function:: void PyLong_FreeExport(PyLongExport *export_long)
@@ -794,6 +794,9 @@ The :c:type:`PyLongWriter` API can be used to import an integer.
794794
On success, return a Python :class:`int` object.
795795
On error, set an exception and return ``NULL``.
796796
797+
The function takes care of normalizing the digits and converts the object
798+
to a compact integer if needed.
799+
797800
798801
.. c:function:: void PyLongWriter_Discard(PyLongWriter *writer)
799802

Include/cpython/longintrepr.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,9 @@ _PyLong_CompactValue(const PyLongObject *op)
142142
/* --- Import/Export API -------------------------------------------------- */
143143

144144
typedef struct PyLongLayout {
145-
// Bits per digit
146145
uint8_t bits_per_digit;
147-
148-
// Digit size in bytes
149146
uint8_t digit_size;
150-
151-
// Digits order:
152-
// * 1 for most significant digit first
153-
// * -1 for least significant first
154147
int8_t digits_order;
155-
156-
// Digit endianness:
157-
// * 1 for most significant byte first (big endian)
158-
// * -1 for least significant first (little endian)
159148
int8_t endianness;
160149
} PyLongLayout;
161150

0 commit comments

Comments
 (0)