mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)
Only __index__ should be used to make integer conversions lossless.
This commit is contained in:
parent
8ad052464a
commit
578c3955e0
87 changed files with 226 additions and 2937 deletions
|
@ -173,23 +173,6 @@ PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
|
|||
unsigned char* bytes, size_t n,
|
||||
int little_endian, int is_signed);
|
||||
|
||||
/* _PyLong_FromNbInt: Convert the given object to a PyLongObject
|
||||
using the nb_int slot, if available. Raise TypeError if either the
|
||||
nb_int slot is not available or the result of the call to nb_int
|
||||
returns something not of type int.
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyLong_FromNbInt(PyObject *);
|
||||
|
||||
/* Convert the given object to a PyLongObject using the nb_index or
|
||||
nb_int slots, if available (the latter is deprecated).
|
||||
Raise TypeError if either nb_index and nb_int slots are not
|
||||
available or the result of the call to nb_index or nb_int
|
||||
returns something not of type int.
|
||||
Should be replaced with PyNumber_Index after the end of the
|
||||
deprecation period.
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyLong_FromNbIndexOrNbInt(PyObject *);
|
||||
|
||||
/* _PyLong_Format: Convert the long to a string object with given base,
|
||||
appending a base prefix of 0[box] if base is 2, 8 or 16. */
|
||||
PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *obj, int base);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue