Possible incoherences on Py_TPFLAGS_HEAPTYPE.
Boris Boutillier
boris.boutillier at arteris.net
Tue Oct 28 09:58:47 EST 2003
I don't know if this is the right place to ask my question, but if needed
I'll post it on the python-dev mailing list.
I'm writing a C-extension module for python 2.3.
I need to declare a new class, MyClass.
For this class I want two things :
1) redefine the setattr function on objects of this class
(ie setting a new tp_setattro)
2) I want that the python user can change attributes on MyClass (the
class itself).
Now I have a conflict on the Py_TPFLAGS_HEAPTYPE with new Python 2.3.
If I have Py_TPFLAGS_HEAPTYPE set on MyClass, I'll have problem with the
new hackcheck (Object/typeobject.c:3631), as I am a HEAPTYPE but I also
redefine tp_setattro.
If I don't have Py_TPFLAGS_HEAPTYPE, the user can't set new attributes on
my class because of a check in type_setattro (Object/typeobject.c:2047).
Have I missed something ?
Boris
More information about the Python-list
mailing list