[ python-Bugs-1595594 ] parser module bug for nested try...except statements
SourceForge.net
noreply at sourceforge.net
Mon Nov 13 14:26:57 CET 2006
Bugs item #1595594, was opened at 2006-11-13 13:00
Message generated for change (Comment added) made by gbrandl
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: Closed
>Resolution: Out of Date
Priority: 5
Private: No
Submitted By: Kay Schluehr (schluehrk)
>Assigned to: Georg Brandl (gbrandl)
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
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2006-11-13 13:26
Message:
Logged In: YES
user_id=849994
I can reproduce this with the 2.5.0 release, but not with
the latest 2.5 SVN or the 2.6 SVN.
Closing as outdated.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1595594&group_id=5470
More information about the Python-bugs-list
mailing list