diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-02-10 15:46:50 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-02-10 15:46:50 (GMT) |
commit | 4015f62e39452db0aa651edcd54b00f4e80e6bb5 (patch) | |
tree | f9d290763c2e993c0465d51a5f70387ff0598ccf /Doc | |
parent | 6a743d3694fb5138f5eab393c172c3b6789b0383 (diff) | |
download | cpython-4015f62e39452db0aa651edcd54b00f4e80e6bb5.zip cpython-4015f62e39452db0aa651edcd54b00f4e80e6bb5.tar.gz cpython-4015f62e39452db0aa651edcd54b00f4e80e6bb5.tar.bz2 |
Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError for
negative arguments. Previously, it raised TypeError.
Thanks Lisandro Dalcin.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/long.rst | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 4b21fd4..5caa89e 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -155,21 +155,32 @@ Long Integer Objects .. cfunction:: PY_LONG_LONG PyLong_AsLongLong(PyObject *pylong) - Return a C :ctype:`long long` from a Python long integer. If *pylong* cannot be - represented as a :ctype:`long long`, an :exc:`OverflowError` will be raised. + .. index:: + single: OverflowError (built-in exception) + + Return a C :ctype:`long long` from a Python long integer. If + *pylong* cannot be represented as a :ctype:`long long`, an + :exc:`OverflowError` is raised and ``-1`` is returned. .. versionadded:: 2.2 .. cfunction:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *pylong) - Return a C :ctype:`unsigned long long` from a Python long integer. If *pylong* - cannot be represented as an :ctype:`unsigned long long`, an :exc:`OverflowError` - will be raised if the value is positive, or a :exc:`TypeError` will be raised if - the value is negative. + .. index:: + single: OverflowError (built-in exception) + + Return a C :ctype:`unsigned long long` from a Python long integer. If + *pylong* cannot be represented as an :ctype:`unsigned long long`, an + :exc:`OverflowError` is raised and ``(unsigned long long)-1`` is + returned. .. versionadded:: 2.2 + .. versionchanged:: 2.7 + A negative *pylong* now raises :exc:`OverflowError`, not + :exc:`TypeError`. + .. cfunction:: unsigned long PyLong_AsUnsignedLongMask(PyObject *io) |