This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2.5 incorrectly permits break inside try statement
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jhylton Nosy List: georg.brandl, jhylton, ncoghlan, nnorwitz
Priority: release blocker Keywords:

Created on 2006-10-03 14:04 by ncoghlan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg30144 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-10-03 14:04
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.
msg30145 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-10-03 14:05
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
msg30146 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-10-04 05:47
Logged In: YES 
user_id=33168

Jeremy checked in r52129 on head.  Needs backport to 2.5.
msg30147 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2006-10-04 14:33
Logged In: YES 
user_id=31392

Fixed on the trunk by r52129. 
msg30148 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-10-08 07:12
Logged In: YES 
user_id=849994

Backported to 2.5 in r52222.
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 44075
2006-10-03 14:04:51ncoghlancreate