diff options
author | Armin Rigo <arigo@tunes.org> | 2006-02-11 21:32:43 (GMT) |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2006-02-11 21:32:43 (GMT) |
commit | f5b3e36493da275334e29afdbd238863697dca35 (patch) | |
tree | 9ddfdb941f79b23a7665f473df37f82f49a80981 /Include | |
parent | cbcdfdc1129cdec27281f62e4494a05405354340 (diff) | |
download | cpython-f5b3e36493da275334e29afdbd238863697dca35.zip cpython-f5b3e36493da275334e29afdbd238863697dca35.tar.gz cpython-f5b3e36493da275334e29afdbd238863697dca35.tar.bz2 |
Renamed _length_cue() to __length_hint__(). See:
http://mail.python.org/pipermail/python-dev/2006-February/060524.html
Diffstat (limited to 'Include')
-rw-r--r-- | Include/abstract.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index 7e0bc4d..fd15173 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -422,20 +422,25 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ PyAPI_FUNC(int) PyObject_Length(PyObject *o); #define PyObject_Length PyObject_Size - PyAPI_FUNC(int) _PyObject_LengthCue(PyObject *o); + PyAPI_FUNC(int) _PyObject_LengthHint(PyObject *o); /* Return the size of object o. If the object, o, provides both sequence and mapping protocols, the sequence size is returned. On error, -1 is returned. If the object provides - a _length_cue() method, its value is returned. This is the + a __length_hint__() method, its value is returned. This is an + internal undocumented API provided for performance reasons; + for compatibility, don't use it outside the core. This is the equivalent to the Python expression: try: return len(o) except (AttributeError, TypeError): - if hasattr(o, '_length_cue'): - return o._length_cue() - raise + exc_type, exc_value, exc_tb = sys.exc_info() + try: + return o.__length_hint__() + except: + pass + raise exc_type, exc_value, exc_tb */ PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); |