diff Python/bltinmodule.c @ 35636:e22334b1da67 legacy-trunk

Convert iterator __len__() methods to a private API.
author Raymond Hettinger <python@rcn.com>
date Sat, 24 Sep 2005 21:23:05 +0000
parents a670a5dd1fc6
children 1c4d192f1568
line wrap: on
line diff
--- a/Python/bltinmodule.c	Sat Sep 24 14:58:47 2005 +0000
+++ b/Python/bltinmodule.c	Sat Sep 24 21:23:05 2005 +0000
@@ -221,7 +221,7 @@
 		goto Fail_arg;
 
 	/* Guess a result list size. */
-	len = PyObject_Size(seq);
+	len = _PyObject_LengthCue(seq);
 	if (len < 0) {
 		if (!PyErr_ExceptionMatches(PyExc_TypeError)  &&
 		    !PyErr_ExceptionMatches(PyExc_AttributeError)) {
@@ -873,7 +873,7 @@
 		}
 
 		/* Update len. */
-		curlen = PyObject_Size(curseq);
+		curlen = _PyObject_LengthCue(curseq);
 		if (curlen < 0) {
 			if (!PyErr_ExceptionMatches(PyExc_TypeError)  &&
 			    !PyErr_ExceptionMatches(PyExc_AttributeError)) {
@@ -2108,7 +2108,7 @@
 	len = -1;	/* unknown */
 	for (i = 0; i < itemsize; ++i) {
 		PyObject *item = PyTuple_GET_ITEM(args, i);
-		int thislen = PyObject_Size(item);
+		int thislen = _PyObject_LengthCue(item);
 		if (thislen < 0) {
 			if (!PyErr_ExceptionMatches(PyExc_TypeError)  &&
 			    !PyErr_ExceptionMatches(PyExc_AttributeError)) {