Author sligocki
Recipients loewis, melicertes, sligocki
Date 2007-09-17.10:13:40
SpamBayes Score 0.00704889
Marked as misclassified No
Message-id <>
I've got a patch! The problem was that the state was being cast from a
C-type unsigned long to a long.

On 32-bit machines this makes large 32-bit longs negative.
On 64-bit machines this preserves the sign of 32-bit values (because
they are stored in 64-bit longs).

My patch returns the values with PyLong_FromUnsignedLong() instead of
PyInt_FromLong(), therefore there is no casting to long and both 32-bit
and 64-bit machines produce the same result.

I added code to read states from the old (buggy) version and decypher it
appropriately (from either 32-bit or 64-bit source!). In other words,
old pickles can now be opened on either architecture with the new patch.

This patch is taken from the svn head, but also works on Python 2.5.1 .

I haven't tested this patch fully on 64-bit machine yet. I'll let you
know when I have.

File name Uploaded
python_head_random.patch sligocki, 2007-09-17.10:13:40
Date User Action Args
2007-09-17 10:13:41sligockisetspambayes_score: 0.00704889 -> 0.00704889
recipients: + sligocki, loewis, melicertes
2007-09-17 10:13:41sligockisetspambayes_score: 0.00704889 -> 0.00704889
messageid: <>
2007-09-17 10:13:41sligockilinkissue1727780 messages
2007-09-17 10:13:40sligockicreate