make too many nested blocks be a SyntaxError instead of a SystemError (closes #27514)
Patch by Ammar Askar.
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 7994fe6..0a61462 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -371,7 +371,9 @@
File "<doctest test.test_syntax[42]>", line 3
SyntaxError: 'break' outside loop
-This should probably raise a better error than a SystemError (or none at all).
+This raises a SyntaxError, it used to raise a SystemError.
+Context for this change can be found on issue #27514
+
In 2.5 there was a missing exception and an assert was triggered in a debug
build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514
@@ -399,7 +401,7 @@
... break
Traceback (most recent call last):
...
- SystemError: too many statically nested blocks
+ SyntaxError: too many statically nested blocks
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,