Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce7b27d

Browse files
committed
merge 3.5 (#27514)
2 parents 663dacd + e09ed54 commit ce7b27d

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

Lib/test/test_syntax.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@
334334
...
335335
SyntaxError: 'break' outside loop
336336
337-
This should probably raise a better error than a SystemError (or none at all).
337+
This raises a SyntaxError, it used to raise a SystemError.
338+
Context for this change can be found on issue #27514
339+
338340
In 2.5 there was a missing exception and an assert was triggered in a debug
339341
build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514
340342
@@ -362,7 +364,7 @@
362364
... break
363365
Traceback (most recent call last):
364366
...
365-
SystemError: too many statically nested blocks
367+
SyntaxError: too many statically nested blocks
366368
367369
Misuse of the nonlocal statement can lead to a few unique syntax errors.
368370

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 alpha 4
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #27514: Make having too many statically nested blocks a SyntaxError
14+
instead of SystemError.
15+
1316
Library
1417
-------
1518

Python/compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4249,7 +4249,7 @@ compiler_push_fblock(struct compiler *c, enum fblocktype t, basicblock *b)
42494249
{
42504250
struct fblockinfo *f;
42514251
if (c->u->u_nfblocks >= CO_MAXBLOCKS) {
4252-
PyErr_SetString(PyExc_SystemError,
4252+
PyErr_SetString(PyExc_SyntaxError,
42534253
"too many statically nested blocks");
42544254
return 0;
42554255
}

0 commit comments

Comments
 (0)