summaryrefslogtreecommitdiffstats
path: root/Include/abstract.h
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-09-24 21:23:05 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-09-24 21:23:05 (GMT)
commit6b27cda64386195cd07dfb686e9486f1c4bc3159 (patch)
tree277a5c96e9683c63b573b508f8c4bd2d1374aed8 /Include/abstract.h
parent9ceebd544516908e67c0f0d92c7a5f484e12beeb (diff)
downloadcpython-6b27cda64386195cd07dfb686e9486f1c4bc3159.zip
cpython-6b27cda64386195cd07dfb686e9486f1c4bc3159.tar.gz
cpython-6b27cda64386195cd07dfb686e9486f1c4bc3159.tar.bz2
Convert iterator __len__() methods to a private API.
Diffstat (limited to 'Include/abstract.h')
-rw-r--r--Include/abstract.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index 17ce105..7e0bc4d 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -422,6 +422,21 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(int) PyObject_Length(PyObject *o);
#define PyObject_Length PyObject_Size
+ PyAPI_FUNC(int) _PyObject_LengthCue(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
+ equivalent to the Python expression:
+ try:
+ return len(o)
+ except (AttributeError, TypeError):
+ if hasattr(o, '_length_cue'):
+ return o._length_cue()
+ raise
+ */
PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key);