Issue27514
Created on 2016-07-14 12:33 by ppperry, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| nested_blocks.diff | ammar2, 2016-07-14 21:24 | review | ||
| nested_blocks.diff2 | ammar2, 2016-07-14 21:37 | review | ||
| Messages (7) | |||
|---|---|---|---|
| msg270405 - (view) | Author: (ppperry) | Date: 2016-07-14 12:33 | |
The following code:
for a in range(26):
for b in range(26):
for c in range(26):
for d in range(26):
for e in range(26):
for f in range(26):
for g in range(26):
for h in range(26):
for i in range(26):
for j in range(26):
for k in range(26):
for l in range(26):
for m in range(26):
for o in range(26):
for p in range(26):
for q in range(26):
for r in range(26):
for s in range(26):
for t in range(26):
for u in range(26):
for v in range(26):
for w in range(26):
pass
fails to compile with `SystemError:too many statically nested blocks`, which was described as a serious bug in issue27081.
|
|||
| msg270409 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2016-07-14 13:41 | |
There is a static limit for the number of statically nested blocks. Getting rid of this limit looks not easy. But SystemError is not an exception that should be raised. SystemError is for errors that can't be occurred in normal case. It should only be caused by incorrect use of C API or hacking Python internals. I think SyntaxError is more appropriate in this case (as in case of passing more than 255 arguments to a function). |
|||
| msg270410 - (view) | Author: Alyssa Coghlan (ncoghlan) * | Date: 2016-07-14 14:09 | |
+1 for Serhiy's recommendation. It's OK for the compiler to say "Don't do that", but the correct error is SyntaxError, even when it's a limitation later in the code generation pipeline (rather than failing to comply with the language grammar) |
|||
| msg270445 - (view) | Author: Ammar Askar (ammar2) * | Date: 2016-07-14 21:24 | |
This patch changes it to a SyntaxError instead of a SystemError. |
|||
| msg270446 - (view) | Author: Ammar Askar (ammar2) * | Date: 2016-07-14 21:37 | |
Amended patch with the comment fixed to refer to just the issue numbers according to advice from bitdancer. |
|||
| msg270462 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2016-07-15 03:22 | |
LGTM. |
|||
| msg270464 - (view) | Author: Roundup Robot (python-dev) | Date: 2016-07-15 05:02 | |
New changeset e6e7c8368c70 by Benjamin Peterson in branch '3.5': make too many nested blocks be a SyntaxError instead of a SystemError (closes #27514) https://hg.python.org/cpython/rev/e6e7c8368c70 New changeset 345ec7455b75 by Benjamin Peterson in branch '2.7': make too many nested blocks be a SyntaxError instead of a SystemError (closes #27514) https://hg.python.org/cpython/rev/345ec7455b75 New changeset d1da87d8b29c by Benjamin Peterson in branch 'default': merge 3.5 (#27514) https://hg.python.org/cpython/rev/d1da87d8b29c |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:33 | admin | set | github: 71701 |
| 2016-07-15 05:02:21 | python-dev | set | status: open -> closed nosy:
+ python-dev resolution: fixed |
| 2016-07-15 03:22:26 | serhiy.storchaka | set | messages:
+ msg270462 stage: needs patch -> commit review |
| 2016-07-14 21:37:19 | ammar2 | set | files:
+ nested_blocks.diff2 messages: + msg270446 |
| 2016-07-14 21:24:07 | ammar2 | set | files:
+ nested_blocks.diff nosy:
+ ammar2 keywords: + patch |
| 2016-07-14 14:09:03 | ncoghlan | set | messages: + msg270410 |
| 2016-07-14 13:41:11 | serhiy.storchaka | set | stage: needs patch messages: + msg270409 versions: + Python 3.5, Python 3.6 |
| 2016-07-14 12:33:51 | ppperry | create | |