Author luizribeiro
Recipients luizribeiro
Date 2011-08-01.22:19:59
SpamBayes Score 3.68527e-05
Marked as misclassified No
Message-id <>
After tracking this issue for a while, I believe this is a problem on the generated AST. Since I'm not very familiar with Jython's inner-workings, can anyone confirm this to me?

Take this example script:
a = 1
b = 2
(a + b)
(a + b).c = 3

The generated AST is:
  ('Assign (1,0)',
   ('targets', ('Name (1,0)', ('id', 'a'), ('ctx', ('Store',)))),
   ('value', ('Num (1,4)', ('n', 1)))),
  ('Assign (2,0)',
   ('targets', ('Name (2,0)', ('id', 'b'), ('ctx', ('Store',)))),
   ('value', ('Num (2,4)', ('n', 2)))),
  ('Expr (3,0)',
    ('BinOp (3,1)',
     ('left', ('Name (3,1)', ('id', 'a'), ('ctx', ('Load',)))),
     ('op', ('Add',)),
     ('right', ('Name (3,5)', ('id', 'b'), ('ctx', ('Load',))))))),
  ('Assign (4,0)',
    ('Attribute (4,0)',
      ('BinOp (4,1)',
       ('left', ('Name (4,1)', ('id', 'a'), ('ctx', ('Store',)))),
       ('op', ('Add',)),
       ('right', ('Name (4,5)', ('id', 'b'), ('ctx', ('Store',)))))),
     ('attr', 'c'),
     ('ctx', ('Store',)))),
   ('value', ('Num (4,12)', ('n', 3))))))

I believe the context from the last statement is wrong. Shouldn't it be using the Load context on the operands of BinOp (4,1)?

In case you're wondering, expressions like (~a).attr = b are also crashing Jython.
Date User Action Args
2011-08-01 22:20:00luizribeirosetmessageid: <>
2011-08-01 22:20:00luizribeirosetrecipients: + luizribeiro
2011-08-01 22:20:00luizribeirolinkissue1764 messages
2011-08-01 22:19:59luizribeirocreate