Issue1530

classification
Title: BoolOp in multiple assign causes VerifyError
Type: behaviour Severity: normal
Components: Versions: 2.5.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: fwierzbicki, pcannata
Priority: Keywords:

Created on 2009-12-30.03:49:46 by pcannata, last changed 2009-12-30.15:39:32 by fwierzbicki.

Messages
msg5396 (view) Author: Philip Cannata (pcannata) Date: 2009-12-30.03:49:45
>>> a=1 and b=2Value is Num
java.lang.VerifyError: (class: org/python/pycode/_pyx3, method: f$0 
signature: (Lorg/python/core/PyFrame;Lorg/python/core/ThreadState;)
Lorg/python/core/PyObject;) Inconsistent stack height 0 != 1
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors
(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.getConstructor(Class.java:1657)
        at org.python.core.BytecodeLoader.makeCode
(BytecodeLoader.java:68)
        at org.python.compiler.LegacyCompiler$LazyLegacyBundle.loadCode
(LegacyCompiler.java:43)
        at org.python.core.CompilerFacade.compile
(CompilerFacade.java:34)
        at org.python.core.Py.compile_flags(Py.java:1651)
        at org.python.core.Py.compile_command_flags(Py.java:1697)
        at org.python.util.InteractiveInterpreter.runsource
(InteractiveInterpreter.java:52)
        at org.python.util.InteractiveInterpreter.runsource
(InteractiveInterpreter.java:46)
        at org.python.util.InteractiveConsole.push
(InteractiveConsole.java:110)
        at org.python.util.InteractiveConsole.interact
(InteractiveConsole.java:90)
        at org.python.util.jython.run(jython.java:316)
        at org.python.util.jython.main(jython.java:129)

java.lang.VerifyError: java.lang.VerifyError: (class: 
org/python/pycode/_pyx3, method: f$0 signature: 
(Lorg/python/core/PyFrame;Lorg/python/core/ThreadState;)
Lorg/python/core/PyObject;) Inconsistent stack height 0 != 1
msg5397 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-12-30.13:07:13
yep, this does indeed crash us.  yuck.
msg5398 (view) Author: Philip Cannata (pcannata) Date: 2009-12-30.14:59:28
Hi Frank, I see you were at Sun until recently :(. I'm at Sun but I 
also teach a Programming Languages course at the University of Texas in 
Austin. I'm considering teaching the internals of Jython in my course 
but I'm just getting familiar with them myself. Would you mind 
answering a question?


In src/org/python/antlr/ast/Assign.java I'd like to see the values 
of "a" and "b" in the execution below.


>>> a, b = 1, 2
PHIL - Assign 2
Target is Tuple(elts=[Name, Name],ctx=Store,)
Value is Tuple(elts=[Num, Num],ctx=Load,)
>>> x=a+b
PHIL - Assign 2
Target is Name(id=x,ctx=Store,)
Value is BinOp(left=Name(id=a,ctx=Load,),op=Add,right=Name
(id=b,ctx=Load,),)

I tried the following in the code:
    public Assign(Integer ttype, Token token, java.util.List<expr> 
targets, expr value) {
        super(ttype, token);
        System.out.println("PHIL - Assign 2");
        this.targets = targets;
        if (targets == null) {
            this.targets = new ArrayList<expr>();
        }
        for(PythonTree t : this.targets) {
            System.out.println("Target is " + t.toStringTree());
            addChild(t);
        }
        System.out.println("Value is " + value.toStringTree());
        this.value = value;
        addChild(value);
    }

but toStringTree() doesn't give the values of the variables. Is there 
some way to get them inside of Assign.java?
thanks
phil

I tried to respond to your email about the but but I got the following:
Subject: Failed issue tracker submission
To: Phil.Cannata@Sun.COM 

You are not a registered user.
msg5399 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-12-30.15:34:01
Hi Philip.  toStringTree has suffered some bit rot -- have you tried
astview.py in the ast/ directory of a Jython checkout?  It will show the
AST pretty nicely.  The best place to ask questions is jython-users or
jython-dev for stuff about the actual development of Jython
http://sourceforge.net/mail/?group_id=12867
msg5400 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-12-30.15:39:31
Fixed in r6958.  Thanks for reporting this!
History
Date User Action Args
2009-12-30 15:39:32fwierzbickisetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg5400
2009-12-30 15:34:01fwierzbickisetmessages: + msg5399
2009-12-30 15:30:38fwierzbickisettitle: >>> a=1 and b=2 crashes interpreter -> BoolOp in multiple assign causes VerifyError
2009-12-30 14:59:29pcannatasetmessages: + msg5398
2009-12-30 13:07:14fwierzbickisetassignee: fwierzbicki
resolution: accepted
messages: + msg5397
nosy: + fwierzbicki
2009-12-30 03:49:46pcannatacreate