Author: Antonio Cuni <[email protected]>
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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit