Lichen

tests/contexts.py

583:aed28d04304d
2017-02-13 Paul Boddie Re-added size information to string instances as the __size__ attribute. This fixes problems introduced when using strlen on data likely to contain embedded nulls, which was the reason for having size information explicitly stored in the first place. attr-strvalue-without-size
     1 class C:     2     l = [2, 4, 6, 8, 10]     3     s = "test"     4     def __init__(self, x):     5         self.x = x     6         self.y = 3     7         self.z = "zebra libre"     8      9 c = C([1])    10 x = c.x    11 f = c.x.__len__    12 print c             # <__main__.C instance>    13 print x             # [1]    14 print f             # __builtins__.list.list.__len__    15 print f()           # 1    16     17 y = c.l    18 g = c.l.__len__    19 print y             # [2, 4, 6, 8, 10]    20 print g             # __builtins__.list.list.__len__    21 print g()           # 5    22     23 yy = C.l    24 gg = C.l.__len__    25 print yy            # [2, 4, 6, 8, 10]    26 print gg            # __builtins__.list.list.__len__    27 print gg()          # 5    28     29 z = c.s    30 h = c.s.__len__    31 print z             # test    32 print h             # __builtins__.str.basestring.__len__    33 print h()           # 4    34     35 zz = C.s    36 hh = C.s.__len__    37 print zz            # test    38 print hh            # __builtins__.str.basestring.__len__    39 print hh()          # 4    40     41 a = c.y    42 b = c.z    43 i = c.z.__len__    44 print a             # 3    45 print b             # zebra libre    46 print i             # __builtins__.str.basestring.__len__    47 print i()           # 11