[pypy-svn] r32522 - in pypy/dist/pypy/module/_random: . test

benyoung at codespeak.net benyoung at codespeak.net
Wed Sep 20 12:44:48 CEST 2006


Author: benyoung
Date: Wed Sep 20 12:44:29 2006
New Revision: 32522

Modified:
   pypy/dist/pypy/module/_random/interp_random.py
   pypy/dist/pypy/module/_random/test/test_random.py
Log:
Make the _random tests pass on Windows

Modified: pypy/dist/pypy/module/_random/interp_random.py
==============================================================================
--- pypy/dist/pypy/module/_random/interp_random.py	(original)
+++ pypy/dist/pypy/module/_random/interp_random.py	Wed Sep 20 12:44:29 2006
@@ -53,7 +53,7 @@
     def getstate(self, space):
         state = [None] * (rpy_random.N + 1)
         for i in range(rpy_random.N):
-            state[i] = space.newint(int(self._rnd.state[i]))
+            state[i] = space.newlong(self._rnd.state[i])
         state[rpy_random.N] = space.newint(self._rnd.index)
         return space.newtuple(state)
     getstate.unwrap_spec = ['self', ObjSpace]
@@ -69,7 +69,7 @@
             w_item = space.getitem(w_state, space.newint(i))
             self._rnd.state[i] = space.uint_w(w_item)
         w_item = space.getitem(w_state, space.newint(rpy_random.N))
-        self._rnd.index = space.uint_w(w_item)
+        self._rnd.index = space.int_w(w_item)
     setstate.unwrap_spec = ['self', ObjSpace, W_Root]
 
     def jumpahead(self, n):

Modified: pypy/dist/pypy/module/_random/test/test_random.py
==============================================================================
--- pypy/dist/pypy/module/_random/test/test_random.py	(original)
+++ pypy/dist/pypy/module/_random/test/test_random.py	Wed Sep 20 12:44:29 2006
@@ -31,7 +31,8 @@
         rnd1.random()
         rnd2 = _random.Random()
         assert rnd1.getstate() != rnd2.getstate()
-        rnd1.setstate(rnd2.getstate())
+        state = rnd2.getstate()
+        rnd1.setstate(state)
         assert [rnd1.random() for i in range(100)] == [
                     rnd2.random() for i in range(100)]
 



More information about the Pypy-commit mailing list