Message8654
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. |
|
Date |
User |
Action |
Args |
2014-06-17 17:25:40 | zyasoft | set | messageid: <1403025940.54.0.482749515222.issue1991@psf.upfronthosting.co.za> |
2014-06-17 17:25:40 | zyasoft | set | recipients:
+ zyasoft, fwierzbicki, zzzeek |
2014-06-17 17:25:40 | zyasoft | link | issue1991 messages |
2014-06-17 17:25:40 | zyasoft | create | |
|