[Python-Dev] Problems with mro for dual inheritance in C [Was: Problems with the Python Memory Manager]
Armin Rigo
arigo at tunes.org
Thu Nov 24 23:24:52 CET 2005
Hi Travis,
On Thu, Nov 24, 2005 at 10:17:43AM -0700, Travis E. Oliphant wrote:
> Why doesn't the int32
> type inherit its tp_free from the early types first?
In your case I suspect that the tp_free is inherited from the tp_base
which is probably 'int'. I don't see how to "fix" typeobject.c, because
I'm not sure that there is a solution that would do the right thing in
all cases at this level.
I would suggest that you just force the tp_alloc/tp_free that you want
in your static types instead. That's what occurs for example if you
build a similar inheritance hierarchy with classes defined in Python:
these classes are then 'heap types', so they always get the generic
tp_alloc/tp_free before PyType_Ready() has a chance to see them.
Armin
More information about the Python-Dev
mailing list