Irit Katriel added the comment:
Victor, it's not clear to me whether this is a bug report or a "how do I do
this" question, but in either case if you posted your code along with "I
expected X but got Y", it would be easier to understand the issue.
--
nosy: +iritkatriel
versions:
Victor Milovanov added the comment:
To put it differently, if you think in terms of MRO, my custom type's MRO is
my_type_clear (from my type), subtype_clear (from PyTypeObject), etc
And subtype_clear incorrectly assumes that it is the first entry in the
object's MRO list for tp_clear.
New submission from Victor Milovanov :
I am trying to define a type in C, that derives from PyTypeObject.
I want to override tp_clear. To do so properly, I should call base type's
tp_clear and have it perform its cleanup steps. PyTypeObject has a tp_clear
implementation: subtype_clear.