summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-09-25 13:04:19 (GMT)
committerGitHub <noreply@github.com>2020-09-25 13:04:19 (GMT)
commit02d126aa09d96d03dcf9c5b51c858ce5ef386601 (patch)
tree85817061b2ed79451edc432495040fc279067e7d /Lib/test/test_syntax.py
parent05cc881cbcf5d73a312568c78c7149eae3195072 (diff)
downloadcpython-02d126aa09d96d03dcf9c5b51c858ce5ef386601.zip
cpython-02d126aa09d96d03dcf9c5b51c858ce5ef386601.tar.gz
cpython-02d126aa09d96d03dcf9c5b51c858ce5ef386601.tar.bz2
bpo-39934: Account for control blocks in 'except' in compiler. (GH-22395)
* Account for control blocks in 'except' in compiler. Fixes #39934.
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 4657fd1..09c6eb3 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -950,6 +950,15 @@ pass
except SyntaxError:
self.fail("Empty line after a line continuation character is valid.")
+ @support.cpython_only
+ def test_nested_named_except_blocks(self):
+ code = ""
+ for i in range(12):
+ code += f"{' '*i}try:\n"
+ code += f"{' '*(i+1)}raise Exception\n"
+ code += f"{' '*i}except Exception as e:\n"
+ code += f"{' '*4*12}pass"
+ self._check_error(code, "too many statically nested blocks")
def test_main():
support.run_unittest(SyntaxTestCase)