diff options
author | Victor Stinner <vstinner@python.org> | 2023-08-24 21:55:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-24 21:55:30 (GMT) |
commit | be436e08b8bd9fcd2202d6ce4d924bba7551e96f (patch) | |
tree | df142099ae50383af0e76ed09f5b4d8d1cc15d3e /Doc/c-api | |
parent | feb9a49c9c09d08cb8c24cb74d90a218de6af244 (diff) | |
download | cpython-be436e08b8bd9fcd2202d6ce4d924bba7551e96f.zip cpython-be436e08b8bd9fcd2202d6ce4d924bba7551e96f.tar.gz cpython-be436e08b8bd9fcd2202d6ce4d924bba7551e96f.tar.bz2 |
gh-108444: Add PyLong_AsInt() public function (#108445)
* Rename _PyLong_AsInt() to PyLong_AsInt().
* Add documentation.
* Add test.
* For now, keep _PyLong_AsInt() as an alias to PyLong_AsInt().
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/long.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index f1354a3..0456048 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -136,6 +136,14 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. This function will no longer use :meth:`~object.__int__`. +.. c:function:: int PyLong_AsInt(PyObject *obj) + + Similar to :c:func:`PyLong_AsLong`, but store the result in a C + :c:expr:`int` instead of a C :c:expr:`long`. + + .. versionadded:: 3.13 + + .. c:function:: long PyLong_AsLongAndOverflow(PyObject *obj, int *overflow) Return a C :c:expr:`long` representation of *obj*. If *obj* is not an |