[Python-Dev] another Py_TPFLAGS_HEAPTYPE question

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Aug 17 03:39:36 CEST 2009


Benjamin Peterson wrote:

> Why do you need to set Py_TPFLAGS_HEAPTYPE on your C type?

I think he *doesn't* want to set Py_TPFLAGS_HEAPTYPE, but
does want to create the type dynamically.

But I suspect this is actually FUD, and that letting
Py_TPFLAGS_HEAPTYPE be set wouldn't lead to anything
disastrous happening.

Note that by not giving instances a __dict__, they
will be prevented from having arbitrary attributes
set on them, which is the most noticeable distinction
between built-in and user-defined types.

-- 
Greg


More information about the Python-Dev mailing list