diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-12-21 11:21:25 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-12-21 11:21:25 (GMT) |
commit | e31d300664f54029ce35ccb78475333b968fdd6b (patch) | |
tree | 6b469de2dddf36cfea121a3fbde49e07c3747f6d /Doc/c-api | |
parent | 2b66da7d15e47f9ca0d08d4f18fc63c3ee6a0d51 (diff) | |
download | cpython-e31d300664f54029ce35ccb78475333b968fdd6b.zip cpython-e31d300664f54029ce35ccb78475333b968fdd6b.tar.gz cpython-e31d300664f54029ce35ccb78475333b968fdd6b.tar.bz2 |
Issue #7528: Backport PyLong_AsLongAndOverflow from py3k to trunk.
Thanks Case Van Horsen for the patch.
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/long.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index c9cb034..7453ccd 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -133,6 +133,19 @@ Long Integer Objects and ``-1`` will be returned. +.. 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` 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``. + + .. versionadded:: 2.7 + + .. cfunction:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong) .. index:: |