This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pm67nz
Recipients
Date 2006-04-19.01:10:57
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
The unsigned long integers which make up the state of a Random 
instance are converted to Python integers via a cast to long in 
_randommodule.c's random_getstate function, so on a 32bit platform 
Random.getstate() returns a mix of postitive and negative integers, while 
on a 64bit platform the negative numbers are replaced by larger positive 
numbers, their 32bit-2s-complement equivalents.

As a result, unpicking a Random instance from a 64bit machine on a 32bit 
platform produces the error "OverflowError: long int too large to convert 
to int".  Unpickling a 32bit Random on a 64bit machine succeeds, but the 
resulting object is in a slightly confused state:

>>> r32 = cPickle.load(open('r32_3.pickle'))
>>> for i in range(3):
...     print r64.random(), r32.random()
... 
0.237964627092 4292886520.32
0.544229225296 0.544229225296
0.369955166548 4292886520.19

History
Date User Action Args
2007-08-23 14:39:32adminlinkissue1472695 messages
2007-08-23 14:39:32admincreate