New submission from Xinmeng Xia <[email protected]>:
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.
----------
components: Interpreter Core
messages: 384797
nosy: xxm
priority: normal
severity: normal
status: open
title: Multiple assignments of attribute "__sizeof__" will cause a segfault
type: crash
versions: Python 3.10
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42887>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com