diff options
author | Georg Brandl <georg@python.org> | 2008-04-26 18:31:07 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-04-26 18:31:07 (GMT) |
commit | 78b3ee8c7b8199708f974c569bb687f4acd0c305 (patch) | |
tree | 381c1acf1476d8a993d68fb6387841492dc8d5a5 /Doc/c-api | |
parent | a3bb57caee0c05536f5cc37e91d7f1c2cefaa620 (diff) | |
download | cpython-78b3ee8c7b8199708f974c569bb687f4acd0c305.zip cpython-78b3ee8c7b8199708f974c569bb687f4acd0c305.tar.gz cpython-78b3ee8c7b8199708f974c569bb687f4acd0c305.tar.bz2 |
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/long.rst | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 49a5e6f..57015db 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -49,6 +49,22 @@ Long Integer Objects *NULL* on failure. +.. cfunction:: PyObject* PyLong_FromSsize_t(Py_ssize_t v) + + Return a new :ctype:`PyLongObject` object from a C :ctype:`Py_ssize_t`, or + *NULL* on failure. + + .. versionadded:: 2.5 + + +.. cfunction:: PyObject* PyLong_FromSize_t(size_t v) + + Return a new :ctype:`PyLongObject` object from a C :ctype:`size_t`, or + *NULL* on failure. + + .. versionadded:: 2.5 + + .. cfunction:: PyObject* PyLong_FromLongLong(PY_LONG_LONG v) Return a new :ctype:`PyLongObject` object from a C :ctype:`long long`, or *NULL* @@ -109,7 +125,21 @@ Long Integer Objects 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`, an :exc:`OverflowError` is raised + and ``-1`` will be returned. + + +.. cfunction:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong) + + .. index:: + single: PY_SSIZE_T_MAX + single: OverflowError (built-in exception) + + Return a C :ctype:`Py_ssize_t` representation of the contents of *pylong*. If + *pylong* is greater than :const:`PY_SSIZE_T_MAX`, an :exc:`OverflowError` is raised + and ``-1`` will be returned. + + .. versionadded:: 2.5 .. cfunction:: unsigned long PyLong_AsUnsignedLong(PyObject *pylong) |