[Zope.Com Geeks] Re: [ZODB-Dev] cPickle: state is not a directory/Upgrade to Zope 2.7failing

Jeremy Hylton jeremy at zope.com
Tue Nov 4 11:25:58 EST 2003


On Tue, 2003-11-04 at 11:17, Tim Peters wrote:
> So the crucial question is who produces DateTime pickles of this form?  All
> such pickles will silently do a wrong thing when loaded with a Python before
> 2.3 (they'll all load as current date and time), and will raise an exception
> when loaded under 2.3+.

That's an excellent question.  The DateTime class in CVS doesn't have an
__getstate__ or an __reduce__.  I can't find any uses of copy_reg that
would register special pickler for dates.

The DateTime class does have an __getinitargs__() method that returns
(None,).  If the DateTime class is passed that as an argument, I think
it creates a new time with the current date.  If I create a pickle by
hand, I get a big pickle for an instance dict with 21 attributes.  (We
ought to be able to make smaller pickles.)

Jeremy





More information about the ZODB-Dev mailing list