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.
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
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