diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2007-12-03 19:20:02 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2007-12-03 19:20:02 +0000 |
commit | 6b449f4f2bd86c104a8b57547428eb9bb3a182b0 (patch) | |
tree | 6ca8ed3d8b4ab7fa6175675e78fba0c481d30d10 /Lib/test/test_random.py | |
parent | 2ec7415db5ad63c4e4b27ee793214071454f6fe5 (diff) | |
download | cpython-git-6b449f4f2bd86c104a8b57547428eb9bb3a182b0.tar.gz |
Issue #1727780: Support loading pickles of random.Random objects created
on 32-bit systems on 64-bit systems, and vice versa. As a consequence
of the change, Random pickles created by Python 2.6 cannot be loaded
in Python 2.5.
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r-- | Lib/test/test_random.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index 29fe42a030..86e2e64b5d 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -140,6 +140,19 @@ class TestBasicOps(unittest.TestCase): restoredseq = [newgen.random() for i in xrange(10)] self.assertEqual(origseq, restoredseq) + def test_bug_1727780(self): + # verify that version-2-pickles can be loaded + # fine, whether they are created on 32-bit or 64-bit + # platforms, and that version-3-pickles load fine. + files = [("randv2_32.pck", 780), + ("randv2_64.pck", 866), + ("randv3.pck", 343)] + for file, value in files: + f = open(test_support.findfile(file),"rb") + r = pickle.load(f) + f.close() + self.assertEqual(r.randrange(1000), value) + class WichmannHill_TestBasicOps(TestBasicOps): gen = random.WichmannHill() |