[pypy-svn] r17557 - in pypy/dist/pypy: . interpreter/astcompiler

ac at codespeak.net ac at codespeak.net
Wed Sep 14 14:05:11 CEST 2005


Author: ac
Date: Wed Sep 14 14:05:11 2005
New Revision: 17557

Modified:
   pypy/dist/pypy/conftest.py
   pypy/dist/pypy/interpreter/astcompiler/pycodegen.py
Log:
Add --compiler option to py.test in pypy.

Modified: pypy/dist/pypy/conftest.py
==============================================================================
--- pypy/dist/pypy/conftest.py	(original)
+++ pypy/dist/pypy/conftest.py	Wed Sep 14 14:05:11 2005
@@ -36,6 +36,9 @@
         Option('--usemodules', action="callback", type="string", metavar="NAME",
                callback=usemodules_callback, default=[],
                help="(mixed) modules to use."),
+        Option('--compiler', action="store", type="string", dest="compiler",
+               metavar="[stable|_stable|ast|cpython]", default='stable',
+               help="""select compiling approach. see pypy/doc/README.compiling""")
     )
 
 _SPACECACHE={}
@@ -57,6 +60,7 @@
             kwds.setdefault('nofaking', option.nofaking)
             kwds.setdefault('oldstyle', option.oldstyle)
             kwds.setdefault('usemodules', option.usemodules)
+            kwds.setdefault('compiler', option.compiler)
             space = Space(**kwds)
         except KeyboardInterrupt: 
             raise 

Modified: pypy/dist/pypy/interpreter/astcompiler/pycodegen.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/pycodegen.py	(original)
+++ pypy/dist/pypy/interpreter/astcompiler/pycodegen.py	Wed Sep 14 14:05:11 2005
@@ -339,6 +339,8 @@
             default.accept( self )
         frees = gen.scope.get_free_vars()
         if frees:
+            # We contain a func with free vars.
+            # Any unqualified exec or import * is a SyntaxError
             for name in frees:
                 self.emitop('LOAD_CLOSURE', name)
             self.emitop_code('LOAD_CONST', gen)
@@ -361,12 +363,15 @@
             base.accept( self )
         self.emitop_int('BUILD_TUPLE', len(node.bases))
         frees = gen.scope.get_free_vars()
-        for name in frees:
-            self.emitop('LOAD_CLOSURE', name)
-        self.emitop_code('LOAD_CONST', gen)
         if frees:
+            # We contain a func with free vars.
+            # Any unqualified exec or import * is a SyntaxError
+            for name in frees:
+                self.emitop('LOAD_CLOSURE', name)
+            self.emitop_code('LOAD_CONST', gen)
             self.emitop_int('MAKE_CLOSURE', 0)
         else:
+            self.emitop_code('LOAD_CONST', gen)
             self.emitop_int('MAKE_FUNCTION', 0)
         self.emitop_int('CALL_FUNCTION', 0)
         self.emit('BUILD_CLASS')
@@ -603,6 +608,8 @@
         self.set_lineno(node)
         frees = gen.scope.get_free_vars()
         if frees:
+            # We contain a func with free vars.
+            # Any unqualified exec or import * is a SyntaxError
             for name in frees:
                 self.emitop('LOAD_CLOSURE', name)
             self.emitop_code('LOAD_CONST', gen)



More information about the Pypy-commit mailing list