[Python-checkins] python/dist/src/Lib random.py,1.50,1.51

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Tue, 24 Jun 2003 13:29:06 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv2903

Modified Files:
	random.py 
Log Message:
SF bug #759889:  Pickling of Random is broken

* Implement __reduce__() to support pickling.
* Add a test case to prove a successful roundtrip through pickle.



Index: random.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** random.py	19 Jun 2003 03:46:46 -0000	1.50
--- random.py	24 Jun 2003 20:29:04 -0000	1.51
***************
*** 124,127 ****
--- 124,130 ----
          self.setstate(state)
  
+     def __reduce__(self):
+         return self.__class__, (), self.getstate()
+ 
  ## -------------------- integer methods  -------------------