[issue45266] subtype_clear can not be called from derived types

2022-01-15 Thread Irit Katriel
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:

[issue45266] subtype_clear can not be called from derived types

2021-09-22 Thread Victor Milovanov
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.

[issue45266] subtype_clear can not be called from derived types

2021-09-22 Thread Victor Milovanov
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.