Skip to content

Commit 4dd85b3

Browse files
authored
gh-137368: document __index__() support for PyLong_AsInt32/64() (GH-137369)
1 parent a46ed66 commit 4dd85b3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/c-api/long.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
372372
Set *\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t`
373373
representation of *obj*.
374374
375+
If *obj* is not an instance of :c:type:`PyLongObject`, first call its
376+
:meth:`~object.__index__` method (if present) to convert it to a
377+
:c:type:`PyLongObject`.
378+
375379
If the *obj* value is out of range, raise an :exc:`OverflowError`.
376380
377381
Set *\*value* and return ``0`` on success.

0 commit comments

Comments
 (0)