Message8654

Author zyasoft
Recipients fwierzbicki, zyasoft, zzzeek
Date 2014-06-17.17:25:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1403025940.54.0.482749515222.issue1991@psf.upfronthosting.co.za>
In-reply-to
Content
Apparently the problem is that itertools.chain (much like some of the other itertools classes that were defined for 2.7) does not extend PyIterator. We also want that to be the case not just for Mike's test case, but also for Java integration since PyIterator also implements the Iterable interface.

A patch like the following is almost complete for Mike's test case; we will need to do the same for most of itertools classes:

 @ExposedType(name = "itertools.chain", base = PyObject.class)
-public class chain extends PyObject {
+public class chain extends PyIterator {

     public static final PyType TYPE = PyType.fromClass(chain.class);
     private itertools.ItertoolsIterator iter;
@@ -84,14 +84,8 @@
         };
     }

-    @ExposedMethod
-    public PyObject __iter__() {
-        return iter;
-    }
-
-    @ExposedMethod
-    public PyObject next() {
-        return iter.next();
+    public PyObject __iternext__() {
+        return iter.__iternext__();
     }

 }

To make this complete, PyIterator should also expose a next method.
History
Date User Action Args
2014-06-17 17:25:40zyasoftsetmessageid: <1403025940.54.0.482749515222.issue1991@psf.upfronthosting.co.za>
2014-06-17 17:25:40zyasoftsetrecipients: + zyasoft, fwierzbicki, zzzeek
2014-06-17 17:25:40zyasoftlinkissue1991 messages
2014-06-17 17:25:40zyasoftcreate