◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
10 changes: 10 additions & 0 deletions Lib/test/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import time
import pickle
import warnings
from functools import partial
from math import log, exp, pi, fsum, sin, factorial
from test import support
Expand Down @@ -372,6 +374,14 @@ def test_pickling(self):
restoredseq = [newgen.random() for i in range(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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18 changes: 18 additions & 0 deletions Modules/_randommodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,30 @@ random_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self;
}

static PyMethodDef random_methods[] = {
_RANDOM_RANDOM_RANDOM_METHODDEF
_RANDOM_RANDOM_SEED_METHODDEF
_RANDOM_RANDOM_GETSTATE_METHODDEF
_RANDOM_RANDOM_SETSTATE_METHODDEF
_RANDOM_RANDOM_GETRANDBITS_METHODDEF
{NULL, NULL} /* sentinel */
};

Expand Down
19 changes: 18 additions & 1 deletion Modules/clinic/_randommodule.c.h
Toggle all file notes Toggle all file annotations