Kaydet (Commit) ce7b27d1 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

merge 3.5 (#27514)

...@@ -334,7 +334,9 @@ isn't, there should be a syntax error. ...@@ -334,7 +334,9 @@ isn't, there should be a syntax error.
... ...
SyntaxError: 'break' outside loop 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 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 build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514
...@@ -362,7 +364,7 @@ build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514 ...@@ -362,7 +364,7 @@ build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514
... break ... break
Traceback (most recent call last): 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. Misuse of the nonlocal statement can lead to a few unique syntax errors.
......
...@@ -10,6 +10,9 @@ What's New in Python 3.6.0 alpha 4 ...@@ -10,6 +10,9 @@ What's New in Python 3.6.0 alpha 4
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #27514: Make having too many statically nested blocks a SyntaxError
instead of SystemError.
Library Library
------- -------
......
...@@ -4249,7 +4249,7 @@ compiler_push_fblock(struct compiler *c, enum fblocktype t, basicblock *b) ...@@ -4249,7 +4249,7 @@ compiler_push_fblock(struct compiler *c, enum fblocktype t, basicblock *b)
{ {
struct fblockinfo *f; struct fblockinfo *f;
if (c->u->u_nfblocks >= CO_MAXBLOCKS) { if (c->u->u_nfblocks >= CO_MAXBLOCKS) {
PyErr_SetString(PyExc_SystemError, PyErr_SetString(PyExc_SyntaxError,
"too many statically nested blocks"); "too many statically nested blocks");
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment