[Python-Dev] Re: marshal / unmarshal

Terry Reedy tjreedy at udel.edu
Sat Apr 9 03:59:32 CEST 2005

"Tim Peters" <tim.peters at gmail.com> wrote in message 
news:1f7befae0504081638145d3b4c at mail.gmail.com...
> All Python behavior in the presence of a NaN, infinity, or signed zero
> is a platform-dependent accident.

The particular issue here is not platform dependence as such but 
within-platform usage dependence, as in the same code giving radically 
different answers in a standard interactive console window and an idle 
window, or when you run it the first time (from xx.py) versus subsequent 
times (from xx.pyc) until you edit the file again. (I verified this on 2.2, 
but MSpencer claimed to have tested on 2.4).  Having the value of an 
expression such as '100 < 1e1000' flip back and forth between True and 
False from run to run *is* distressing for some people ;-).

I know that this has come up before as 'wont fix' bug, but it might be 
better to have invalid floats like 1e1000, etc, not compile and raise an 
exception (at least on Windows) instead of breaking the reasonable 
expectation that unmarshal(marshal(codeob)) == codeob.  That would force 
people (at least on Windows) to do something more more within-platform 

>If marshal could reliably detect a NaN, then of course unmarshal
>should reliably reproduce the NaN -- provided the platform on which
>it's unpacked supports NaNs

Windows seems to support +- INF just fine, doing arithmetic and comparisons 
'correctly'.  So it seems that detection or reproduction is the problem.

Terry J. Reedy

More information about the Python-Dev mailing list