[pypy-commit] pypy default: rewrite r_rand at interp level: this way we don't need to import the applevel random module which takes forever on top of py.py, and the tests run much quicker
antocuni
noreply at buildbot.pypy.org
Fri Mar 16 10:39:07 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r53712:93ea391d2bbf
Date: 2012-03-16 10:38 +0100
http://bitbucket.org/pypy/pypy/changeset/93ea391d2bbf/
Log: rewrite r_rand at interp level: this way we don't need to import the
applevel random module which takes forever on top of py.py, and the
tests run much quicker
diff --git a/pypy/objspace/std/test/test_userobject.py b/pypy/objspace/std/test/test_userobject.py
--- a/pypy/objspace/std/test/test_userobject.py
+++ b/pypy/objspace/std/test/test_userobject.py
@@ -10,10 +10,10 @@
from pypy import conftest
cls.space = conftest.gettestobjspace(**cls.OPTIONS)
cls.w_runappdirect = cls.space.wrap(bool(conftest.option.runappdirect))
-
- def w_rand(self):
- import random
- return random.randrange(0, 5)
+ def rand(space):
+ import random
+ return space.wrap(random.randrange(0, 5))
+ cls.w_rand = cls.space.wrap(gateway.interp2app(rand))
def test_emptyclass(self):
class empty(object): pass
More information about the pypy-commit
mailing list