class Y(object): pass class type1(Y, type): pass class X(object): __metaclass__ = type1 # now X.__dict__ can be read, assigned to, and deleted del X.__dict__ print X # segfault