Bugs item #1595594, was opened at 2006-11-13 14:00
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1595594&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: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Kay Schluehr (schluehrk)
Assigned to: Nobody/Anonymous (nobody)
Summary: parser module bug for nested try...except statements
Initial Comment:
The following block of source code causes an exception
when tried to parse, listify and restoring an ast
object:
source = """
try:
try:
TRY_BLOCK
except EXC1:
EXC_BLOCK1
except EXC2:
EXC_BLOCK1
except EXC3:
FIN_BLOCK
"""
import parser
stlist = parser.suite(source).tolist() # o.k.
parser.sequence2st(stlist)
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
ParserError: Expected node type 297, got -31392.
The node value -31392 is at random and not
reproducable.
The problem does not occur when only one except branch
in the inner try is used:
source = """
try:
try:
TRY_BLOCK
except EXC1:
EXC_BLOCK1
except EXC3:
FIN_BLOCK
"""
import parser
stlist = parser.suite(source).tolist() # o.k.
parser.sequence2st(stlist) # o.k.
It also doesn't occur for an outer finally-clause
instead of an except clause.
The problem is reproducable for Python 2.5
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1595594&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com