1.1 --- a/common.py Sat Mar 11 23:39:20 2017 +0100
1.2 +++ b/common.py Sat Mar 11 23:42:48 2017 +0100
1.3 @@ -551,20 +551,32 @@
1.4 the iterator, producing a replacement node for the original.
1.5 """
1.6
1.7 + t0 = self.get_temporary_name()
1.8 + self.next_temporary()
1.9 + t1 = self.get_temporary_name()
1.10 + self.next_temporary()
1.11 i0 = self.get_temporary_name()
1.12 self.next_temporary()
1.13
1.14 node = compiler.ast.Stmt([
1.15
1.16 - # <next> = {n.list}.__iter__().next
1.17 + # <t0> = {n.list}
1.18 + # <t1> = <t0>.__iter__()
1.19 + # <i0> = <t1>.next
1.20 +
1.21 + compiler.ast.Assign(
1.22 + [compiler.ast.AssName(t0, "OP_ASSIGN")],
1.23 + n.list),
1.24 +
1.25 + compiler.ast.Assign(
1.26 + [compiler.ast.AssName(t1, "OP_ASSIGN")],
1.27 + compiler.ast.CallFunc(
1.28 + compiler.ast.Getattr(compiler.ast.Name(t0), "__iter__"),
1.29 + [])),
1.30
1.31 compiler.ast.Assign(
1.32 [compiler.ast.AssName(i0, "OP_ASSIGN")],
1.33 - compiler.ast.Getattr(
1.34 - compiler.ast.CallFunc(
1.35 - compiler.ast.Getattr(n.list, "__iter__"),
1.36 - []
1.37 - ), "next")),
1.38 + compiler.ast.Getattr(compiler.ast.Name(t1), "next")),
1.39
1.40 # try:
1.41 # while True: