diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-12 17:03:09 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-12 17:03:09 (GMT) |
commit | 8a87f5d37e6aab91ddc4c6491877b6cbd48a12cf (patch) | |
tree | 330bb4b553958f129b31e31ccea2a2c835b19de0 /Doc/api | |
parent | f3e304297e94b9b1956a4ed95debd1b163958d71 (diff) | |
download | cpython-8a87f5d37e6aab91ddc4c6491877b6cbd48a12cf.zip cpython-8a87f5d37e6aab91ddc4c6491877b6cbd48a12cf.tar.gz cpython-8a87f5d37e6aab91ddc4c6491877b6cbd48a12cf.tar.bz2 |
Patch #1538606, Patch to fix __index__() clipping.
I modified this patch some by fixing style, some error checking, and adding
XXX comments. This patch requires review and some changes are to be expected.
I'm checking in now to get the greatest possible review and establish a
baseline for moving forward. I don't want this to hold up release if possible.
Diffstat (limited to 'Doc/api')
-rw-r--r-- | Doc/api/abstract.tex | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/Doc/api/abstract.tex b/Doc/api/abstract.tex index f740efb..9c39403 100644 --- a/Doc/api/abstract.tex +++ b/Doc/api/abstract.tex @@ -693,12 +693,31 @@ determination. \samp{float(\var{o})}.\bifuncindex{float} \end{cfuncdesc} -\begin{cfuncdesc}{Py_ssize_t}{PyNumber_Index}{PyObject *o} - Returns the \var{o} converted to a Py_ssize_t integer on success, or - -1 with an exception raised on failure. +\begin{cfuncdesc}{PyObject*}{PyNumber_Index}{PyObject *o} + Returns the \var{o} converted to a Python int or long on success or \NULL{} + with a TypeError exception raised on failure. \versionadded{2.5} \end{cfuncdesc} +\begin{cfuncdesc}{Py_ssize_t}{PyNumber_AsSsize_t}{PyObject *o, PyObject *exc} + Returns \var{o} converted to a Py_ssize_t value if \var{o} + can be interpreted as an integer. If \var{o} can be converted to a Python + int or long but the attempt to convert to a Py_ssize_t value + would raise an \exception{OverflowError}, then the \var{exc} argument + is the type of exception that will be raised (usually \exception{IndexError} + or \exception{OverflowError}). If \var{exc} is \NULL{}, then the exception + is cleared and the value is clipped to \var{PY_SSIZE_T_MIN} + for a negative integer or \var{PY_SSIZE_T_MAX} for a positive integer. + \versionadded{2.5} +\end{cfuncdesc} + +\begin{cfuncdesc}{int}{PyIndex_Check}{PyObject *o} + Returns True if \var{o} is an index integer (has the nb_index slot of + the tp_as_number structure filled in). + \versionadded{2.5} +\end{cfuncdesc} + + \section{Sequence Protocol \label{sequence}} \begin{cfuncdesc}{int}{PySequence_Check}{PyObject *o} |