[Python-Dev] Py_TPFLAGS_HEAPTYPE too overloaded

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jul 27 03:05:55 CEST 2009


Joshua Haberman wrote:
> This is not as bad as having someone
> set __class__ on one of my instances, or set attributes on my type, etc.

Is there any real need to prevent someone from doing
those things?

Note that even when you are allowed to change the
__class__ of an instance, you're still prevented
from changing it to something that has a different
C layout, so you can't crash the intepreter that
way.

Similarly, built-in methods check that they're
given an object of appropriate type at the C
level.

My suggestion is to just let it be a full heap
type and accept whatever consequences follow.

-- 
Greg


More information about the Python-Dev mailing list