Lichen

tests/assign_attr.py

1036:e8ff2a117367
5 months ago Paul Boddie Fixed accessor temporary storage reservation for lambdas and eliminated redundant temporary storage reservation in attribute accesses.
     1 class C:     2     def __init__(self, x):     3         self.x = x     4      5     def __str__(self):     6         return "C(%r)" % self.x     7      8     __repr__ = __str__     9     10 class D:    11     x = 1    12     13 def f():    14     return D    15     16 c = C(C(1)) # c.x.x = 1    17 print c     # C(C(1))    18 print c.x   # C(1)    19 print c.x.x # 1    20 c.x.x = 2    21 print c     # C(C(2))    22 print c.x   # C(2)    23 print c.x.x    24     25 print D.x   # 1    26 D.x = 2    27 print D.x   # 2    28 D.x = C(3)    29 print D.x   # C(3)    30 print D.x.x # 3    31 D.x.x = 4    32 print D.x.x # 4    33     34 f().x = 5    35 print D.x   # 5