Issue574546

classification
Title: CodeCompiler.visitAugAssign : bad visit
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: bbouwens, bckfnn
Priority: normal Keywords:

Created on 2002-06-27.12:18:56 by bbouwens, last changed 2002-07-03.21:37:39 by bckfnn.

Messages
msg677 (view) Author: Bram Bouwens (bbouwens) Date: 2002-06-27.12:18:56
In my application there is a line like

  item.attribute += "value"

which doesn't work. The attribute is looked up with
the __getattr__ method as item is a wrapper around a
Java object.

So this is effectively equivalent to

  item.__getattr__("attribute").__iadd__("value")

When I replace the above line with

  item.attribute.__iadd__("value")

it works fine. I noticed that the original version causes
a call to

  item.__setattr__(None)

(or something else instead of None) which is not to be
expected.
The problem went away when I commented out line 1293
of org/python/compiler/CodeCompiler.java  rev. 2.28.
That line must be useless (so by definition incorrect)
as the augbinop already does the store itself.
msg678 (view) Author: Finn Bock (bckfnn) Date: 2002-07-03.21:37:39
Logged In: YES 
user_id=4201

This is not a bug. The result of augmented assignment
operator must be rebound back as a attribute or index or
name. It is not acceptable to depend solely on the __iadd__
to modify the attribute.
History
Date User Action Args
2002-06-27 12:18:56bbouwenscreate