A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-August/068157.html below:

[Python-Dev] __index__ clipping

[Python-Dev] __index__ clipping [Python-Dev] __index__ clippingTravis E. Oliphant oliphant.travis at ieee.org
Fri Aug 11 09:51:04 CEST 2006
Here is my C-API proposal

1) PyIndex_Check(obj)

   Similar to PyIter_Check(obj) as it just checks for whether or not the 
object can call nb_index.  Actually implemented as a macro.

2) PyObject* PyNumber_Index(obj)

   Simple interface around nb_index that calls it if possible and returns
   TypeError if not (or if the result does not end up in an exact
   int-or-long

3) Py_ssize_t PyNumber_AsSsize_t(obj, err)

    This converts the object to a Py_ssize_t by using the nb_index call
    if possible.  The err argument is a Python error object and specifies
    what error should be raised should the conversion from Int-or-Long to
    Py_ssize_t cause Overflow.

    If err is NULL, then no error will be raised and the result will be 
clipped.  Other-wise the corresponding error will be set.  Internally 
PyExc_IndexError and PyExc_OverflowError will be the errors used.


-Travis






More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4