https://github.com/python/cpython/commit/7f5319dd545b836090496a1f2b9f13667a3cd4e5 commit: 7f5319dd545b836090496a1f2b9f13667a3cd4e5 branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: hugovk <[email protected]> date: 2025-09-11T12:14:03+03:00 summary:
[3.14] gh-137368: document __index__() support for PyLong_AsInt32/64() (GH-137369) (#137380) gh-137368: document __index__() support for PyLong_AsInt32/64() (GH-137369) (cherry picked from commit 4dd85b347fd8264453811e0873e0dffa333d9838) Co-authored-by: Sergey B Kirpichev <[email protected]> files: M Doc/c-api/long.rst diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 2d0bda76697e81..31e2cd57034467 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -372,6 +372,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. Set *\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_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 + :c:type:`PyLongObject`. + If the *obj* value is out of range, raise an :exc:`OverflowError`. Set *\*value* and return ``0`` on success. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
