[pypy-commit] pypy space-newtext: random

cfbolz pypy.commits at gmail.com
Thu Nov 3 07:56:06 EDT 2016


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: space-newtext
Changeset: r88118:7f9a88e99894
Date: 2016-11-03 12:13 +0100
http://bitbucket.org/pypy/pypy/changeset/7f9a88e99894/

Log:	random

diff --git a/pypy/module/_random/interp_random.py b/pypy/module/_random/interp_random.py
--- a/pypy/module/_random/interp_random.py
+++ b/pypy/module/_random/interp_random.py
@@ -13,7 +13,7 @@
     x = space.allocate_instance(W_Random, w_subtype)
     x = space.interp_w(W_Random, x)
     W_Random.__init__(x, space, w_anything)
-    return space.wrap(x)
+    return x
 
 
 class W_Random(W_Root):
@@ -34,7 +34,7 @@
                 w_n = space.abs(w_n)
             else:
                 n = space.hash_w(w_n)
-                w_n = space.wrap(r_uint(n))
+                w_n = space.newint(r_uint(n))
         key = []
         w_one = space.newint(1)
         w_two = space.newint(2)
@@ -54,7 +54,7 @@
     def getstate(self, space):
         state = [None] * (rrandom.N + 1)
         for i in range(rrandom.N):
-            state[i] = space.wrap(widen(self._rnd.state[i]))
+            state[i] = space.newint(widen(self._rnd.state[i]))
         state[rrandom.N] = space.newlong(self._rnd.index)
         return space.newtuple(state)
 


More information about the pypy-commit mailing list