Skip to content

Commit 511bab9

Browse files
skirpichevhugovk
authored andcommitted
PEP 757: address gpshead's review (python#4144)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent e6f6043 commit 511bab9

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

peps/pep-0757.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ functions.
7979
- ``1`` for most significant digit first
8080
- ``-1`` for least significant digit first
8181

82-
.. c:member:: int8_t endianness
82+
.. c:member:: int8_t digit_endianness
8383
8484
Digit endianness:
8585

@@ -177,19 +177,20 @@ create a Python :class:`int` object from a digits array.
177177
178178
Create a :c:type:`PyLongWriter`.
179179
180-
On success, set *\*digits* and return a writer.
180+
On success, allocate *\*digits* and return a writer.
181181
On error, set an exception and return ``NULL``.
182182
183183
*negative* is ``1`` if the number is negative, or ``0`` otherwise.
184184
185-
*ndigits* is the number of digits in the *digits* array. It must be
186-
greater than or equal to 0.
185+
*ndigits* is the number of digits in the *digits* array. It must be
186+
greater than 0.
187187
188-
The caller can either initialize the array of digits *digits* and then call
189-
:c:func:`PyLongWriter_Finish` to get a Python :class:`int`, or call
188+
The caller can either initialize the array of digits *digits* and then
189+
either call :c:func:`PyLongWriter_Finish` to get a Python :class:`int` or
190190
:c:func:`PyLongWriter_Discard` to destroy the writer instance. Digits must
191-
be in the range [``0``; ``(1 << sys.int_info.bits_per_digit) - 1``]. Unused
192-
digits must be set to ``0``.
191+
be in the range [``0``; ``(1 << bits_per_digit) - 1``] (where the
192+
:c:struct:`~PyLongLayout.bits_per_digit` is the number of bits per digit).
193+
The unused most-significant digits must be set to ``0``.
193194
194195
195196
On CPython 3.14, the :c:func:`PyLongWriter_Create` implementation is a thin
@@ -206,11 +207,15 @@ wrapper to the private :c:func:`!_PyLong_New()` function.
206207
The function takes care of normalizing the digits and converts the
207208
object to a compact integer if needed.
208209
210+
The writer instance is invalid after the call.
211+
209212
210213
.. c:function:: void PyLongWriter_Discard(PyLongWriter *writer)
211214
212215
Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`.
213216
217+
The writer instance is invalid after the call.
218+
214219
215220
Optimize import for small integers
216221
==================================
@@ -252,7 +257,7 @@ Code::
252257
int int_digits_order = layout->digits_order;
253258
size_t int_bits_per_digit = layout->bits_per_digit;
254259
size_t int_nails = int_digit_size*8 - int_bits_per_digit;
255-
int int_endianness = layout->endianness;
260+
int int_endianness = layout->digit_endianness;
256261
257262
258263
Export: :c:func:`PyLong_Export()` with gmpy2

0 commit comments

Comments
 (0)