It appears that pickle protocol 2 chokes on inf.
As above. BTW, why protocol 2 specifically? Protocols 1 and 2 treat
floats the same way.
I was thinking that the default protocol is 1, but I see
now that the default is 0.
Strange, eh? Since only protocol 0 existed at first, I suppose this
was a nod to backward compatibility.
2.4.2 on OS X can pickle infinity using
protocol 0, but attempts to pickle infinity using protocols
1 or 2 raise a SystemError.
All of which are platform-dependent accidents.
Pickling infinity works fine, just as you say, in 2.5,
using any of the protocols.
Well, I meant what I said ;-):
In 2.5, marshal and pickle (but only with protocol >= 1) can at
least pack and unpack them reliably across most IEEE-754 boxes.
It's /still/ an accident that protocol 0 worked for you under 2.5.
WinTel is the major example of a 754 box where protocol 0 still
doesn't work under 2.5, and probably never will (Microsoft's C
implementation can't read the strings it produces for infinities or
NaNs, which pretty much dooms "text mode" pickles forever in those
Python 2.6a0 (trunk:51860, Sep 11 2006, 15:23:15) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
p = cPickle.dumps(1e300 * 1e300)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: could not convert string to float
p = cPickle.dumps(1e300 * 1e300, 1)
So protocol 0 still fails, while protocol 1 (or higher) works, and all
of them fail on WinTel before 2.5.
Thanks for the explanation.
Hey, it's always my pleasure to spread fear :-)
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org