[Python-Dev] Re: [spambayes-dev] RE: RE: [Spambayes] Question (orpossibly a bug report)

Tim Peters tim.one@comcast.net
Fri, 25 Jul 2003 12:19:07 -0400


[Scott David Daniels]
> ...
> The idea is to change the unmarshal code to transform the 19-byte
> string to the 24-byte string '010000000000000001e-17' before calling
> atof.  I suppose the marshal code could be converted to generate it,
> but I was suggesting a way of reading the current format by fiddling
> bytes before calling atof.

The unmarshaling code is part of the Python core, and written in C.  So we
can't change that without releasing a new Python, and requiring that people
use that new version.  The float(1)/10 "idea" was in the context of
workarounds that can avoid the problems today, using the Pythons people
already have.

The other half of this problem hasn't been mentioned yet because it hasn't
come up yet in the spambayes context:  if locale happens to get changed
while Python is *compiling* a module, the marshaling code can end up writing
out a float string with (e.g.) a comma instead of a period.

IOW, there isn't a quick hack that's going to solve all the potential
problems here (and they're not limited to marshal, either).