From fd060474e3cc51528d321bbd52323036f9fda80d Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 13 Jul 2011 21:02:22 +0200 Subject: Make it clear that PyNumber_AsSsize_t() returns -1 on error. --- Doc/c-api/number.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/c-api/number.rst b/Doc/c-api/number.rst index eda722d..090fc64 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 -- cgit v0.12