[David Abrahams]
I /guess/ there's a bug in my code if you measure it against the standard that says "if it doesn't work with the current Python source code, it's buggy". I'd consider that standard a bit more legitimate if I could find, for example, a mention of Py_TPFLAGS_HEAPTYPE *anywhere* in the Python docs.
I've been struggling with the meaning of the various TPFLAGS myself. I don't think it's documented anywhere, and I don't think anyone except Guido really understands what all the flags mean. One property of types that do not have define HEAPTYPE is that their __module__ attribute is always __builtin__. This makes them mighty hard to pickle. It further suggests that every type that isn't a builtin type should define HEAPTYPE. There are lots of other cases affected by HEAPTYPE. I imagine you've done the same grep that I did. Jeremy