1.1 --- a/common.py Thu Jan 17 18:26:05 2019 +0100
1.2 +++ b/common.py Thu Jan 24 17:39:40 2019 +0100
1.3 @@ -3,8 +3,8 @@
1.4 """
1.5 Common functions.
1.6
1.7 -Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013,
1.8 - 2014, 2015, 2016, 2017, 2018 Paul Boddie <paul@boddie.org.uk>
1.9 +Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
1.10 + 2017, 2018, 2019 Paul Boddie <paul@boddie.org.uk>
1.11
1.12 This program is free software; you can redistribute it and/or modify it under
1.13 the terms of the GNU General Public License as published by the Free Software
1.14 @@ -582,7 +582,7 @@
1.15 # <var>... = <t2>()
1.16 # ...
1.17 # except StopIteration:
1.18 - # pass
1.19 + # {n.else_}
1.20
1.21 compiler.ast.Assign(
1.22 [compiler.ast.AssName(t2, "OP_ASSIGN")],
1.23 @@ -600,7 +600,7 @@
1.24 )),
1.25 n.body]),
1.26 None),
1.27 - [(compiler.ast.Name("StopIteration"), None, compiler.ast.Stmt([compiler.ast.Pass()]))],
1.28 + [(compiler.ast.Name("StopIteration"), None, n.else_ or compiler.ast.Pass())],
1.29 None)
1.30 ])
1.31
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/tests/for.py Thu Jan 24 17:39:40 2019 +0100
2.3 @@ -0,0 +1,16 @@
2.4 +l = [1, 2, 3]
2.5 +
2.6 +for i in l:
2.7 + print i # 1
2.8 + # 2
2.9 + # 3
2.10 +else:
2.11 + print 4 # 4
2.12 +
2.13 +for i in l:
2.14 + print i # 1
2.15 + # 2
2.16 + if i == 2:
2.17 + break
2.18 +else:
2.19 + print 3