[Python-Dev] Change in unpickle order in 2.2?

Greg Ward gward@mems-exchange.org
Thu, 10 Jan 2002 13:04:52 -0500


I have an application (Grouch) that has to do a lot of trickery at
pickle-time and unpickle-time, and as a result it happens to be
sensitive to the order of unpickling.

(The reason for the pickle-time intervention is that Grouch stores type
objects in its data structure, and you can't pickle type objects.  So it
hangs on to a representive value of the type for pickling -- eg. for the
"integer" type, it keeps both IntType and 0 in memory, but only pickles
0, and uses type(0) to get IntType back at unpickle time.)

The reason that Grouch is sensitive to the order of unpickling is
because its data structure is a gnarly, incestuous knot of mutually
interdependent classes, and I stopped tinkering with the pickle code as
soon as I got something that worked with Python 2.0 and 2.1.  Now it
fails under 2.2.  Under 2.1, it appears that certain more-deeply nested
objects were unpickled first; under 2.2, that is no longer the case, and
that screws up Grouch's test suite.

Anyone got a vague, hand-waving explanation for my vague, hand-waving
complaint?  Or should I try to come up with a test case?

Thanks --

        Greg
-- 
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange                            http://www.mems-exchange.org