summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@gmail.com>2008-02-04 01:04:35 (GMT)
committerJeffrey Yasskin <jyasskin@gmail.com>2008-02-04 01:04:35 (GMT)
commita26cf9b7609fc1c08fd1a69ddf5e44dc98a70dce (patch)
tree6950856bc7823c7907e4546d4920a59724424062 /Include
parent72a6576279b81213c426d1022ddc97f30a698636 (diff)
downloadcpython-a26cf9b7609fc1c08fd1a69ddf5e44dc98a70dce.zip
cpython-a26cf9b7609fc1c08fd1a69ddf5e44dc98a70dce.tar.gz
cpython-a26cf9b7609fc1c08fd1a69ddf5e44dc98a70dce.tar.bz2
Make int() and long() fall back to __trunc__(). See issue 2002.
Diffstat (limited to 'Include')
-rw-r--r--Include/abstract.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index b7fde09..e6cbb7b 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -761,6 +761,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
converting the int-or-long to Py_ssize_t, then the second argument