2.0b2: SystemError: frexp() result out of range

Tim Peters tim at digicool.com
Tue Jul 24 15:29:15 EDT 2001

[Anthony J Doggett (UG)]
> Please, if I were to ask nicely for our local installation of python to
> be upgraded, would the bug shown below to go away?
> > python
> Python 2.0b2 (#1, Oct  9 2000, 18:12:36)
> [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
> Type "copyright", "credits" or "license" for more information.
> >>> import cPickle
> >>> f = open('delme', 'w')
> >>> cPickle.dump(float('inf'), f, 1)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> SystemError: frexp() result out of range

I doubt this has anything to do with the version of Python you're using.
Python is complaining because the platform C library function frexp is
returning a result x such that

    x == 0 || (x >= 0.5 && x < 1.0)

is not true.  It's almost certainly returning an infinity instead.  If
that's what your platform frexp does with an infinity, you're
stuck with it until they replace the C librarym or a version of Python that
doesn't exist yet knows what to do with an infinity result from frexp().

> What's the best way to get around it?

Get rid of infinities before pickling.

good-advice-in-any-walk-of-life<wink>-ly y'rs  - tim

More information about the Python-list mailing list