[Python-checkins] python/dist/src/Include abstract.h,2.51,2.52

rhettinger@users.sourceforge.net rhettinger at users.sourceforge.net
Sat Sep 24 23:23:08 CEST 2005


Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7585/Include

Modified Files:
	abstract.h 
Log Message:
Convert iterator __len__() methods to a private API.

Index: abstract.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v
retrieving revision 2.51
retrieving revision 2.52
diff -u -d -r2.51 -r2.52
--- abstract.h	12 Mar 2004 16:38:17 -0000	2.51
+++ abstract.h	24 Sep 2005 21:23:05 -0000	2.52
@@ -422,6 +422,21 @@
      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);
 



More information about the Python-checkins mailing list