diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-02-10 16:13:25 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-02-10 16:13:25 (GMT) |
commit | 21776074cc300dbdea412aa57cb6efdd126dcff6 (patch) | |
tree | 572f170fc1e492de76de035241f3d77228c9c171 /Doc | |
parent | eeba356308cd6e6e11ed8c50e5d6ebac32b42e1c (diff) | |
download | cpython-21776074cc300dbdea412aa57cb6efdd126dcff6.zip cpython-21776074cc300dbdea412aa57cb6efdd126dcff6.tar.gz cpython-21776074cc300dbdea412aa57cb6efdd126dcff6.tar.bz2 |
Merged revisions 69498 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r69498 | mark.dickinson | 2009-02-10 15:46:50 +0000 (Tue, 10 Feb 2009) | 6 lines
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 | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index a7fe4b5..a8dc3ec 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -168,17 +168,26 @@ All integers are implemented as "long" integer objects of arbitrary size. .. cfunction:: PY_LONG_LONG PyLong_AsLongLong(PyObject *pylong) - Return a C :ctype:`long long` from a Python 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 integer. If *pylong* + cannot be represented as a :ctype:`long long`, an + :exc:`OverflowError` is raised and ``-1`` is returned. .. cfunction:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *pylong) - Return a C :ctype:`unsigned long long` from a Python 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 integer. If + *pylong* cannot be represented as an :ctype:`unsigned long long`, + an :exc:`OverflowError` is raised and ``(unsigned long long)-1`` is + returned. + .. versionchanged:: 3.1 + A negative *pylong* now raises :exc:`OverflowError`, not + :exc:`TypeError`. .. cfunction:: unsigned long PyLong_AsUnsignedLongMask(PyObject *io) |