Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e09ed541
Commit
e09ed541
authored
Jul 14, 2016
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make too many nested blocks be a SyntaxError instead of a SystemError (closes #27514)
Patch by Ammar Askar.
parent
2b879213
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
Lib/test/test_syntax.py
Lib/test/test_syntax.py
+4
-2
Misc/NEWS
Misc/NEWS
+3
-0
Python/compile.c
Python/compile.c
+1
-1
No files found.
Lib/test/test_syntax.py
View file @
e09ed541
...
@@ -342,7 +342,9 @@ isn't, there should be a syntax error.
...
@@ -342,7 +342,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
...
@@ -370,7 +372,7 @@ 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
... break
Traceback (most recent call last):
Traceback (most recent call last):
...
...
Sy
stem
Error: too many statically nested blocks
Sy
ntax
Error: 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.
...
...
Misc/NEWS
View file @
e09ed541
...
@@ -10,6 +10,9 @@ Release date: TBA
...
@@ -10,6 +10,9 @@ Release date: TBA
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #27514: Make having too many statically nested blocks a SyntaxError
instead of SystemError.
- Issue #27473: Fixed possible integer overflow in bytes and bytearray
- Issue #27473: Fixed possible integer overflow in bytes and bytearray
concatenations. Patch by Xiang Zhang.
concatenations. Patch by Xiang Zhang.
...
...
Python/compile.c
View file @
e09ed541
...
@@ -3980,7 +3980,7 @@ compiler_push_fblock(struct compiler *c, enum fblocktype t, basicblock *b)
...
@@ -3980,7 +3980,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_Sy
stem
Error
,
PyErr_SetString
(
PyExc_Sy
ntax
Error
,
"too many statically nested blocks"
);
"too many statically nested blocks"
);
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment