[ python-Bugs-1569998 ] 2.5 incorrectly permits break inside try statement

SourceForge.net noreply at sourceforge.net
Tue Oct 3 16:05:15 CEST 2006


Bugs item #1569998, was opened at 2006-10-04 00:04
Message generated for change (Comment added) made by ncoghlan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1569998&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parser/Compiler
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Nick Coghlan (ncoghlan)
Assigned to: Nobody/Anonymous (nobody)
Summary: 2.5 incorrectly permits break inside try statement

Initial Comment:
The new AST compiler permits the break statement inside
*any* frame block, rather than requiring that there be
a loop somewhere on the block stack.

Will add examples in a comment where SF shouldn't
destroy the formatting.

----------------------------------------------------------------------

>Comment By: Nick Coghlan (ncoghlan)
Date: 2006-10-04 00:05

Message:
Logged In: YES 
user_id=1038590

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> try:
...     print 1
...     break
...     print 2
... finally:
...     print 3
...
SyntaxError: 'break' outside loop

Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.>>> try:
...     print 1
...     break
...     print 2
... finally:
...     print 3
...
1
3

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1569998&group_id=5470


More information about the Python-bugs-list mailing list