SF bug #759889: Pickling of Random is broken
* Implement __reduce__() to support pickling.
* Add a test case to prove a successful roundtrip through pickle.
diff --git a/Lib/random.py b/Lib/random.py
index 1ae2553..1a0b8f3 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -123,6 +123,9 @@
def __setstate__(self, state): # for pickle
self.setstate(state)
+ def __reduce__(self):
+ return self.__class__, (), self.getstate()
+
## -------------------- integer methods -------------------
def randrange(self, start, stop=None, step=1, int=int, default=None):