Skip to content

Commit 1f2cf3a

Browse files
committed
Doc tweaks
1 parent 376e358 commit 1f2cf3a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Doc/c-api/long.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
119119
*buffer*, interpreted as a two's-complement signed number.
120120
121121
*endianness* may be passed ``-1`` for the native endian that CPython was
122-
compiled with, or ``0`` for big endian and ``1`` for little.
122+
compiled with, or else ``0`` for big endian and ``1`` for little.
123123
124124
.. versionadded:: 3.13
125125
@@ -130,7 +130,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
130130
*buffer*, interpreted as an unsigned number.
131131
132132
*endianness* may be passed ``-1`` for the native endian that CPython was
133-
compiled with, or ``0`` for big endian and ``1`` for little.
133+
compiled with, or else ``0`` for big endian and ``1`` for little.
134134
135135
.. versionadded:: 3.13
136136
@@ -371,20 +371,21 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
371371
*endianness* may be passed ``-1`` for the native endian that CPython was
372372
compiled with, or ``0`` for big endian and ``1`` for little.
373373
374-
Returns ``-1`` with an exception raised if *pylong* cannot be interpreted as
375-
an integer. Otherwise, returns the size of the buffer required to store the
374+
Return ``-1`` with an exception raised if *pylong* cannot be interpreted as
375+
an integer. Otherwise, return the size of the buffer required to store the
376376
value. If this is equal to or less than *n_bytes*, the entire value was
377377
copied.
378378
379379
Unless an exception is raised, all *n_bytes* of the buffer will be written
380380
with as much of the value as can fit. This allows the caller to ignore all
381-
non-negative results, if the intent is to match the typical behavior of a
381+
non-negative results if the intent is to match the typical behavior of a
382382
C-style downcast.
383383
384384
Values are always copied as twos-complement, and sufficient size will be
385385
requested for a sign bit. For example, this may cause an value that fits into
386-
8-bytes when treated as unsigned to request 9 bytes, even though all eight
387-
bytes were copied into the buffer.
386+
8 bytes when treated as unsigned to request 9 bytes, even though all eight
387+
bytes were copied into the buffer. What has been omitted is the zero sign
388+
bit, which is redundant when the intention is to treat the value as unsigned.
388389
389390
Passing *n_bytes* of zero will always return the requested buffer size.
390391

0 commit comments

Comments
 (0)