Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd06047

Browse files
committed
Make it clear that PyNumber_AsSsize_t() returns -1 on error.
1 parent 325eb47 commit fd06047

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Doc/c-api/number.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ Number Protocol
249249
.. c:function:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc)
250250
251251
Returns *o* converted to a Py_ssize_t value if *o* can be interpreted as an
252-
integer. If *o* can be converted to a Python int but the attempt to
252+
integer. If the call fails, an exception is raised and -1 is returned.
253+
254+
If *o* can be converted to a Python int but the attempt to
253255
convert to a Py_ssize_t value would raise an :exc:`OverflowError`, then the
254256
*exc* argument is the type of exception that will be raised (usually
255257
:exc:`IndexError` or :exc:`OverflowError`). If *exc* is *NULL*, then the

0 commit comments

Comments
 (0)