summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-07-15 05:00:03 (GMT)
committerBenjamin Peterson <benjamin@python.org>2016-07-15 05:00:03 (GMT)
commite09ed5419b84040a6f5d74ec9a3ae4fd9b4bc0e5 (patch)
treeaa635fb5095afc603285433e46875096b2911619 /Lib
parent2b8792137bf5e02ee4263822f818b31b68830f4b (diff)
downloadcpython-e09ed5419b84040a6f5d74ec9a3ae4fd9b4bc0e5.zip
cpython-e09ed5419b84040a6f5d74ec9a3ae4fd9b4bc0e5.tar.gz
cpython-e09ed5419b84040a6f5d74ec9a3ae4fd9b4bc0e5.tar.bz2
make too many nested blocks be a SyntaxError instead of a SystemError (closes #27514)
Patch by Ammar Askar.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_syntax.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 057441c..83f49f6 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -342,7 +342,9 @@ isn't, there should be a syntax error.
...
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
@@ -370,7 +372,7 @@ build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514
... break
Traceback (most recent call last):
...
- SystemError: too many statically nested blocks
+ SyntaxError: too many statically nested blocks
Misuse of the nonlocal statement can lead to a few unique syntax errors.