class.__flags__ & _HEAPTYPE check in 2.2.1? Why?

Mike C. Fletcher mcfletch at
Thu Aug 8 08:02:04 CEST 2002

I was just looking over the source of in Python 2.2.1, and 
noticed that the code is looking for __flags__ on the class objects. 
This appears to be a new 2.2 feature based on the tp_flags slot.

Okay, says I, but here's the thing, _why_ does copy_reg care about the 
_HEAPTYPE flag 1<<9 (which is from object.h, apparently) when doing 
pickling/copying?  Is there some reason such objects can't be pickled?

In my particular case, I'm looking at allowing pickling of objects to 
disk which are normally not picklable (sub-classes of ZODB4's Persistent 
class).  I'm basically wondering what this machinery is there for, and 
if killing it off for a particular run of a program will precipitate the 
end of civilisation?

Thoughts from the gurus?
   Mike C. Fletcher
   Designer, VR Plumber, Coder

More information about the Python-list mailing list