Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue27514

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:SystemError when compiling deeply nested for loops
Type:behaviorStage:resolved
Components:Interpreter CoreVersions:Python 3.6, Python 3.5, Python 2.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: ammar2, benjamin.peterson, brett.cannon, georg.brandl, ncoghlan, ppperry, python-dev, serhiy.storchaka, yselivanov
Priority:normalKeywords:patch

Created on2016-07-14 12:33 byppperry, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
nested_blocks.diffammar2,2016-07-14 21:24review
nested_blocks.diff2ammar2,2016-07-14 21:37review
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):                         passfails to compile with `SystemError:too many statically nested blocks`, which was described as a serious bug inissue27081.
msg270409 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)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)*(Python committer)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)*(Python committer)Date: 2016-07-14 21:24
This patch changes it to a SyntaxError instead of a SystemError.
msg270446 -(view)Author: Ammar Askar (ammar2)*(Python committer)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)*(Python committer)Date: 2016-07-15 03:22
LGTM.
msg270464 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2016-07-15 05:02
New changesete6e7c8368c70 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/e6e7c8368c70New changeset345ec7455b75 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/345ec7455b75New changesetd1da87d8b29c by Benjamin Peterson in branch 'default':merge 3.5 (#27514)https://hg.python.org/cpython/rev/d1da87d8b29c
History
DateUserActionArgs
2022-04-11 14:58:33adminsetgithub: 71701
2016-07-15 05:02:21python-devsetstatus: open -> closed

nosy: +python-dev
messages: +msg270464

resolution: fixed
stage: commit review -> resolved
2016-07-15 03:22:26serhiy.storchakasetmessages: +msg270462
stage: needs patch -> commit review
2016-07-14 21:37:19ammar2setfiles: +nested_blocks.diff2

messages: +msg270446
2016-07-14 21:24:07ammar2setfiles: +nested_blocks.diff

nosy: +ammar2
messages: +msg270445

keywords: +patch
2016-07-14 14:09:03ncoghlansetmessages: +msg270410
2016-07-14 13:41:11serhiy.storchakasetstage: needs patch
messages: +msg270409
versions: + Python 3.5, Python 3.6
2016-07-14 12:33:51ppperrycreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp