Petr Viktorin <[email protected]> added the comment:
You are missing m_free.
The clear function is used to break reference counts. In this case, there are
no reference counts to be broken, so it is not called.
Your custom_clear function is idempotent, so you can use it in both free and
clear and let Python call it either once or twice:
.m_clear = custom_clear,
.m_free = custom_clear,
I agree that this is not at all clear from the documentation. I'm going to
spend some time organizing the info around the GC API and writing it up.
----------
nosy: +petr.viktorin
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue44301>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com