[Python-ideas] Do we need non-heap types any more? (Was: Implicit submodule imports)

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 26 23:43:53 CEST 2014


Antoine Pitrou wrote:
> The tp_dealloc for a heap type is not the same as the non-heap base
> type's tp_dealloc.
> 
> Also, look at compatible_for_assignment(): it calls same_slots_added()
> which assumes both args are heap types.

It looks like the easiest way to address this particular
use case would be to make the module type a heap type.

In the long term, how about turning *all* types into
heap types? We're already having to call PyType_Ready
on all the static type objects, so allocating them
from the heap shouldn't incur much extra overhead.

Seems to me that this would simplify a lot of the
cpython code and make it easier to maintain. As it
is, thinking about all the tricky differences between
heap and non-heap types makes my head hurt.

-- 
Greg


More information about the Python-ideas mailing list