[pypy-commit] pypy default: Add list-comprehension-operation to checkconfig by default, have a test that

fijal noreply at buildbot.pypy.org
Wed Dec 7 19:22:25 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r50281:f8b238a469f4
Date: 2011-12-07 20:21 +0200
http://bitbucket.org/pypy/pypy/changeset/f8b238a469f4/

Log:	Add list-comprehension-operation to checkconfig by default, have a
	test that checks if micronumpy translates

diff --git a/pypy/module/micronumpy/test/test_ztranslation.py b/pypy/module/micronumpy/test/test_ztranslation.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/micronumpy/test/test_ztranslation.py
@@ -0,0 +1,5 @@
+
+from pypy.objspace.fake.checkmodule import checkmodule
+
+def test_numpy_translates():
+    checkmodule('micronumpy')
diff --git a/pypy/objspace/fake/checkmodule.py b/pypy/objspace/fake/checkmodule.py
--- a/pypy/objspace/fake/checkmodule.py
+++ b/pypy/objspace/fake/checkmodule.py
@@ -9,4 +9,4 @@
     for name in module.loaders:
         module._load_lazily(space, name)
     #
-    space.translates()
+    space.translates(**{'translation.list_comprehension_operations':True})
diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py
--- a/pypy/objspace/fake/objspace.py
+++ b/pypy/objspace/fake/objspace.py
@@ -11,6 +11,7 @@
 from pypy.rlib.nonconst import NonConstant
 from pypy.rlib.rarithmetic import r_uint
 from pypy.translator.translator import TranslationContext
+from pypy.tool.option import make_config
 
 
 class W_MyObject(Wrappable):
@@ -227,13 +228,14 @@
 
     # ----------
 
-    def translates(self, func=None, argtypes=None):
+    def translates(self, func=None, argtypes=None, **kwds):
+        config = make_config(None, **kwds)
         if func is not None:
             if argtypes is None:
                 nb_args = func.func_code.co_argcount
                 argtypes = [W_Root] * nb_args
         #
-        t = TranslationContext()
+        t = TranslationContext(config=config)
         self.t = t     # for debugging
         ann = t.buildannotator()
         if func is not None:


More information about the pypy-commit mailing list