[ZODB-Dev] Problem Storing Infinity

Tim Peters tim.peters at gmail.com
Tue Sep 12 14:11:02 EDT 2006


[Chris S]
> I'm having a problem storing infinity. The following code reproduces
> the problem on w2k:

Purely a Python issue.  Nothing about the behavior of infinities, NaNs
or signed zeroes is defined in Python before (the not yet released)
2.5.  In 2.5, marshal and pickle (but only with protocol >= 1) can at
least pack and unpack them reliably across most IEEE-754 boxes.  ZODB
will inherit that when used with Python 2.5.  Before then, sorry, but
no chance.

...
> try:
>     root['data'] = 1e99999999

Also undefined what that literal might mean.

This is all platform-dependent accident, essentially because Python
inherits most of its knowledge of floats from the platform C
implementation, and nothing about IEEE-754 special values is defined
in the C89 standard -- different C implementations slobber all over
the map in what they do with such things.
...

>     self._p.dump(state)
> SystemError: frexp() result out of range

Yup, that's one of the platform-dependent accidents you might see.
Reflects that this platform C's libm's frexp() implementation happens
to be unhappy with infinities.  Some are, some aren't.

[David Binger]
> That's interesting.
> 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.

[Jim Fulton]
> Yeah, especially because I didn't realize we were using protocol 2 yet.

Strongly doubt that ZODB uses protocol 2 anywhere yet.


More information about the ZODB-Dev mailing list