[ python-Bugs-1557232 ] Parser crash

SourceForge.net noreply at sourceforge.net
Wed Sep 13 08:00:18 CEST 2006


Bugs item #1557232, was opened at 2006-09-12 08:28
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1557232&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: 7
Submitted By: Martin v. Löwis (loewis)
Assigned to: Nobody/Anonymous (nobody)
Summary: Parser crash

Initial Comment:
The code

def x(((y))):pass 

crashes the compiler (?) in 2.5c2, on Windows.

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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-09-12 23:00

Message:
Logged In: YES 
user_id=33168

I guess what 2.4 does is the most reasonable behavior:

>>> def f((((((x)),),),)): pass
>>> dis.dis(f)
  1           0 LOAD_FAST                0 (.0)
              3 UNPACK_SEQUENCE          1
              6 UNPACK_SEQUENCE          1
              9 UNPACK_SEQUENCE          1
             12 STORE_FAST               1 (x)
             15 LOAD_CONST               0 (None)
             18 RETURN_VALUE        


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

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-09-12 22:50

Message:
Logged In: YES 
user_id=33168

The problem is in Python/ast.c around line 666.  See the
comment:

/* def foo((x)): setup for checking NAME below. */

The code is not sufficient, we need a loop and need to
handle various combinations of:

def f(((((x))),)),))): pass

I don't know if the parens above match, but the general idea
is that there could be a bunch of parens and commas at
various places.  I'm not sure how the above should be
interpreted.

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

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


More information about the Python-bugs-list mailing list