mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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().
This commit is contained in:
parent
feb9a49c9c
commit
be436e08b8
13 changed files with 96 additions and 3 deletions
|
@ -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
|
||||
|
|
1
Doc/data/stable_abi.dat
generated
1
Doc/data/stable_abi.dat
generated
|
@ -347,6 +347,7 @@ var,PyList_Type,3.2,,
|
|||
type,PyLongObject,3.2,,opaque
|
||||
var,PyLongRangeIter_Type,3.2,,
|
||||
function,PyLong_AsDouble,3.2,,
|
||||
function,PyLong_AsInt,3.13,,
|
||||
function,PyLong_AsLong,3.2,,
|
||||
function,PyLong_AsLongAndOverflow,3.2,,
|
||||
function,PyLong_AsLongLong,3.2,,
|
||||
|
|
|
@ -871,6 +871,12 @@ New Features
|
|||
:term:`shutting down <interpreter shutdown>`.
|
||||
(Contributed by Victor Stinner in :gh:`108014`.)
|
||||
|
||||
* Add :c:func:`PyLong_AsInt` function: similar to :c:func:`PyLong_AsLong`, but
|
||||
store the result in a C :c:expr:`int` instead of a C :c:expr:`long`.
|
||||
Previously, it was known as the private function :c:func:`!_PyLong_AsInt`
|
||||
(with an underscore prefix).
|
||||
(Contributed by Victor Stinner in :gh:`108014`.)
|
||||
|
||||
Porting to Python 3.13
|
||||
----------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue