Skip to content
Prev Previous commit
Next Next commit
Address Bénédikt's review
  • Loading branch information
vstinner committed Aug 27, 2024
commit 0199a80231f0c463a278969d3da7684ec8b8a558
12 changes: 8 additions & 4 deletions Doc/c-api/long.rst
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,24 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
.. c:function:: int PyLong_AsInt32(PyObject *obj, int32_t *value)
int PyLong_AsInt64(PyObject *obj, int64_t *value)

Return a signed C :c:expr:`int32_t` or :c:expr:`int64_t` representation of
*obj*.
Set *\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t`
representation of *obj*.

If the *obj* value is out of range, raise an :exc:`OverflowError`.

Set *\*value* and return ``0`` on success.
Set an exception and return ``-1`` on error.

*value* must not be ``NULL``.

.. versionadded:: 3.14


.. c:function:: int PyLong_AsUInt32(PyObject *obj, uint32_t *value)
int PyLong_AsUInt64(PyObject *obj, uint64_t *value)

Return an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t` representation
of *obj*.
Set *\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t`
representation of *obj*.

If *obj* is not an instance of :c:type:`PyLongObject`, first call its
:meth:`~object.__index__` method (if present) to convert it to a
Expand All @@ -385,6 +387,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
Set *\*value* and return ``0`` on success.
Set an exception and return ``-1`` on error.

*value* must not be ``NULL``.

.. versionadded:: 3.14


Expand Down