Simply a typo in NextNode...
code.putln(
"if (!%s) {" %
self.result_code)
- code.error_goto_if_PyErr(self.pos)
+ code.putln(code.error_goto_if_PyErr(self.pos))
code.putln("break;")
code.putln("}")
code.putln("}")
--- /dev/null
+__doc__ = """
+ >>> f()
+"""
+
+class IteratorAndIterateable:
+ def next(self):
+ raise ValueError("")
+ def __iter__(self):
+ return self
+
+def f():
+ try:
+ for x in IteratorAndIterateable():
+ pass
+ assert False, "Should not reach this point, iterator has thrown exception"
+ except ValueError:
+ pass