1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/failure/outer_stupid.py Mon Jan 13 23:58:23 2014 +0100
1.3 @@ -0,0 +1,16 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +"Inspired by difflib._mdiff._line_iterator and its from_line variable."
1.7 +
1.8 +def outer():
1.9 + def inner(x):
1.10 + if x:
1.11 + y = 1
1.12 + return y
1.13 + y = 2
1.14 + return inner
1.15 +
1.16 +result_1 = outer()(1)
1.17 +result_2 = outer()(0) # CPython fails with UnboundLocalError in inner
1.18 +
1.19 +# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/tests/failure/outer_stupid_explicit.py Mon Jan 13 23:58:23 2014 +0100
2.3 @@ -0,0 +1,18 @@
2.4 +#!/usr/bin/env python
2.5 +
2.6 +"Inspired by difflib._mdiff._line_iterator and its from_line variable."
2.7 +
2.8 +def outer():
2.9 + def inner(x):
2.10 + if x:
2.11 + y = 1
2.12 + return y
2.13 + else:
2.14 + return y
2.15 + y = 2
2.16 + return inner
2.17 +
2.18 +result_1 = outer()(1)
2.19 +result_2 = outer()(0) # CPython fails with UnboundLocalError in inner
2.20 +
2.21 +# vim: tabstop=4 expandtab shiftwidth=4