summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2007-12-04 22:10:37 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2007-12-04 22:10:37 (GMT)
commitd1a1d1ed802187cd1a9a8a95ac5d758c7acffee6 (patch)
tree17489e6ea4df32ba3b3bbda6e4b31155a460f265 /Doc
parent0fbab7ff8d2efd92e222fcc13c0aff0998c3c158 (diff)
downloadcpython-d1a1d1ed802187cd1a9a8a95ac5d758c7acffee6.zip
cpython-d1a1d1ed802187cd1a9a8a95ac5d758c7acffee6.tar.gz
cpython-d1a1d1ed802187cd1a9a8a95ac5d758c7acffee6.tar.bz2
Remove PyInt_CheckExact. Add PyLong_AsLongAndOverflow.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/concrete.rst15
1 files changed, 10 insertions, 5 deletions
diff --git a/Doc/c-api/concrete.rst b/Doc/c-api/concrete.rst
index eefd927..f90ab4f 100644
--- a/Doc/c-api/concrete.rst
+++ b/Doc/c-api/concrete.rst
@@ -211,10 +211,6 @@ All integers are implemented as "long" integer objects of arbitrary size.
:ctype:`PyLongObject`.
-.. XXX cfunction PyInt_CheckExact(PyObject *p) checks if argument is a long
- object and fits into a C long
-
-
.. cfunction:: PyObject* PyLong_FromLong(long v)
Return a new :ctype:`PyLongObject` object from *v*, or *NULL* on failure.
@@ -297,7 +293,16 @@ All integers are implemented as "long" integer objects of arbitrary size.
single: OverflowError (built-in exception)
Return a C :ctype:`long` representation of the contents of *pylong*. If
- *pylong* is greater than :const:`LONG_MAX`, an :exc:`OverflowError` is raised.
+ *pylong* is greater than :const:`LONG_MAX`, raise an :exc:`OverflowError`,
+ and return -1. Convert non-long objects automatically to long first,
+ and return -1 if that raises exceptions.
+
+.. cfunction:: long PyLong_AsLongAndOverflow(PyObject *pylong, int* overflow)
+
+ Return a C :ctype:`long` representation of the contents of *pylong*. If
+ *pylong* is greater than :const:`LONG_MAX`, return -1 and
+ set `*overflow` to 1 (for overflow) or -1 (for underflow).
+ If an exception is set because of type errors, also return -1.
.. cfunction:: unsigned long PyLong_AsUnsignedLong(PyObject *pylong)