mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Make int() and long() fall back to __trunc__(). See issue 2002.
This commit is contained in:
parent
72a6576279
commit
a26cf9b760
5 changed files with 232 additions and 3 deletions
|
@ -760,6 +760,19 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
|||
|
||||
PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc);
|
||||
|
||||
/*
|
||||
Returns the Integral instance converted to an int. The
|
||||
instance is expected to be int or long or have an __int__
|
||||
method. Steals integral's reference. error_format will be
|
||||
used to create the TypeError if integral isn't actually an
|
||||
Integral instance. error_format should be a format string
|
||||
that can accept a char* naming integral's type.
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyNumber_ConvertIntegralToInt(
|
||||
PyObject *integral,
|
||||
const char* error_format);
|
||||
|
||||
/*
|
||||
Returns the object converted to Py_ssize_t by going through
|
||||
PyNumber_Index first. If an overflow error occurs while
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue