From: Antoine Pitrou Date: Wed, 13 Jul 2011 19:02:22 +0000 (+0200) Subject: Make it clear that PyNumber_AsSsize_t() returns -1 on error. X-Git-Tag: v3.2.2rc1~120 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fd060474e3cc51528d321bbd52323036f9fda80d;p=thirdparty%2FPython%2Fcpython.git Make it clear that PyNumber_AsSsize_t() returns -1 on error. --- diff --git a/Doc/c-api/number.rst b/Doc/c-api/number.rst index eda722d9e846..090fc649f172 100644 --- a/Doc/c-api/number.rst +++ b/Doc/c-api/number.rst @@ -249,7 +249,9 @@ Number Protocol .. c:function:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc) Returns *o* converted to a Py_ssize_t value if *o* can be interpreted as an - integer. If *o* can be converted to a Python int but the attempt to + integer. If the call fails, an exception is raised and -1 is returned. + + If *o* can be converted to a Python int but the attempt to convert to a Py_ssize_t value would raise an :exc:`OverflowError`, then the *exc* argument is the type of exception that will be raised (usually :exc:`IndexError` or :exc:`OverflowError`). If *exc* is *NULL*, then the