This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xxm
Recipients xxm
Date 2021-01-11.07:38:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610350684.08.0.491719857036.issue42887@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-01-11 07:38:04xxmsetrecipients: + xxm
2021-01-11 07:38:04xxmsetmessageid: <1610350684.08.0.491719857036.issue42887@roundup.psfhosted.org>
2021-01-11 07:38:04xxmlinkissue42887 messages
2021-01-11 07:38:03xxmcreate