Message6593

Author luizribeiro
Recipients luizribeiro
Date 2011-08-01.22:19:59
SpamBayes Score 3.68527e-05
Marked as misclassified No
Message-id <1312237200.24.0.116961563847.issue1764@psf.upfronthosting.co.za>
In-reply-to
Content
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:
('Module',
 ('body',
  ('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)',
   ('value',
    ('BinOp (3,1)',
     ('left', ('Name (3,1)', ('id', 'a'), ('ctx', ('Load',)))),
     ('op', ('Add',)),
     ('right', ('Name (3,5)', ('id', 'b'), ('ctx', ('Load',))))))),
  ('Assign (4,0)',
   ('targets',
    ('Attribute (4,0)',
     ('value',
      ('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.
History
Date User Action Args
2011-08-01 22:20:00luizribeirosetmessageid: <1312237200.24.0.116961563847.issue1764@psf.upfronthosting.co.za>
2011-08-01 22:20:00luizribeirosetrecipients: + luizribeiro
2011-08-01 22:20:00luizribeirolinkissue1764 messages
2011-08-01 22:19:59luizribeirocreate