summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/long.rst
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-12-21 12:37:06 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-12-21 12:37:06 (GMT)
commit309aa2dcb488074161c86257d4ddfe104d1ec53a (patch)
tree50fea960f2f61c80b404fe826b52d1fd9a2fb01e /Doc/c-api/long.rst
parent6193aeee32e12654b41b4130f59ce1c63aa8afa5 (diff)
downloadcpython-309aa2dcb488074161c86257d4ddfe104d1ec53a.zip
cpython-309aa2dcb488074161c86257d4ddfe104d1ec53a.tar.gz
cpython-309aa2dcb488074161c86257d4ddfe104d1ec53a.tar.bz2
Keep PyLong_AsLongAndOverflow documentation and implementation in sync
between py3k and trunk; merge new tests from trunk to py3k. (See issue #7528.)
Diffstat (limited to 'Doc/c-api/long.rst')
-rw-r--r--Doc/c-api/long.rst11
1 files changed, 7 insertions, 4 deletions
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst
index 19d65b8..083fe8b 100644
--- a/Doc/c-api/long.rst
+++ b/Doc/c-api/long.rst
@@ -121,10 +121,13 @@ All integers are implemented as "long" integer objects of arbitrary size.
.. 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.
+ Return a C :ctype:`long` representation of the contents of
+ *pylong*. If *pylong* is greater than :const:`LONG_MAX` or less
+ than :const:`LONG_MIN`, set `*overflow` to ``1`` or ``-1``,
+ respectively, and return ``-1``; otherwise, set `*overflow` to
+ ``0``. If any other exception occurs (for example a TypeError or
+ MemoryError), then ``-1`` will be returned and ``*overflow`` will
+ be ``0``.
.. cfunction:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong)