[issue42887] 100000 assignments of .__sizeof__ cause a segfault on del

Serhiy Storchaka report at bugs.python.org
Mon Jan 18 05:54:03 EST 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Yes, there is an overhead of using the trashcan mechanism. This is why it is only used in data collections, because it is expected that your data can contain arbitrary long chains of links. There is many ways to create arbitrary long chains with other objects, but it does not happen in common code. For methods the cost would be especially high, because method objects are usually short-lived and the performance of creating/destroying is critical.

AFAIK the same issue (maybe not with __sizeof__, but with other method of the basic object class, like __reduce__) was already reported earlier. I propose to close  this issue as "won't fix".

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42887>
_______________________________________


More information about the Python-bugs-list mailing list