[issue42887] Multiple assignments of attribute "__sizeof__" will cause a segfault

2021-01-11 Thread Ronald Oussoren
Ronald Oussoren added the comment: This is a recursion problem, "mystr" will be equivalent to 'hello123'.__sizeof__.__sizeof__. ...(100K repetition)... .__sizeof__. The dealloc of "mystr" will cause recursive calls to tp_dealloc along the entire chain and that can exhaust the C stack.

[issue42887] Multiple assignments of attribute "__sizeof__" will cause a segfault

2021-01-11 Thread Christian Heimes
Christian Heimes added the comment: I can reproduce the issue. The stack trace is several hundred thousand (!) levels deep. #0 _Py_DECREF (op=, lineno=514, filename=0x6570af "./Include/object.h") at ./Include/object.h:448 #1 _Py_XDECREF (op=) at ./Include/object.h:514 #2 meth_dealloc

[issue42887] Multiple assignments of attribute "__sizeof__" will cause a segfault

2021-01-10 Thread Xinmeng Xia
New submission from Xinmeng Xia : 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