Message384797
In the following program 1, method "__sizeof__()" is called and assigned multiple times. The program can work well on Python 3.10. However if I change "__sizeof__()" to "__sizeof__". Then a segmentation fault is reported. I think something wrong for the parser when dealing build-in attribute assignment.
program 1:
=========================
mystr = "hello123"
for x in range(1000000):
mystr = mystr.__sizeof__()
print(mystr)
=========================
56
28
28
.......
28
28
Output: work well as expected.
program 2:
==========================
mystr = "hello123"
for x in range(1000000):
mystr = mystr.__sizeof__
print(mystr)
==========================
<built-in method __sizeof__ of builtin_function_or_method object at 0x7f04d3e0c220>
......
<built-in method __sizeof__ of builtin_function_or_method object at 0x7f04d3e0c4f0>
<built-in method __sizeof__ of builtin_function_or_method object at 0x7f04d3e0c540>
Segmentation fault (core dumped)
Expected output: no segfault. |
|
Date |
User |
Action |
Args |
2021-01-11 07:38:04 | xxm | set | recipients:
+ xxm |
2021-01-11 07:38:04 | xxm | set | messageid: <1610350684.08.0.491719857036.issue42887@roundup.psfhosted.org> |
2021-01-11 07:38:04 | xxm | link | issue42887 messages |
2021-01-11 07:38:03 | xxm | create | |
|