diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-12-29 16:08:34 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-12-29 16:08:34 (GMT) |
commit | 3cc8f4b9693572e6ea423881cdbebfc981307b50 (patch) | |
tree | d4c387193a04e023c7a3dac2f79dac28536e7f7a /Lib/test/test_syntax.py | |
parent | 01f7ac3bb07ccca254af27f046ef64f9f5641e05 (diff) | |
download | cpython-3cc8f4b9693572e6ea423881cdbebfc981307b50.zip cpython-3cc8f4b9693572e6ea423881cdbebfc981307b50.tar.gz cpython-3cc8f4b9693572e6ea423881cdbebfc981307b50.tar.bz2 |
make recording and reporting errors and nonlocal and global directives more robust (closes #25973)
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r-- | Lib/test/test_syntax.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index a22cebb..057441c 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -416,6 +416,14 @@ TODO(jhylton): Figure out how to test SyntaxWarning with doctest. ## ... ## SyntaxWarning: name 'x' is assigned to before nonlocal declaration + From https://bugs.python.org/issue25973 + >>> class A: + ... def f(self): + ... nonlocal __x + Traceback (most recent call last): + ... + SyntaxError: no binding for nonlocal '_A__x' found + This tests assignment-context; there was a bug in Python 2.5 where compiling a complex 'if' (one with 'elif') would fail to notice an invalid suite, |