[pypy-svn] r12061 - pypy/dist/pypy/module/recparser

arigo at codespeak.net arigo at codespeak.net
Sun May 8 10:35:12 CEST 2005


Author: arigo
Date: Sun May  8 10:35:12 2005
New Revision: 12061

Modified:
   pypy/dist/pypy/module/recparser/pyparser.py
Log:
Import statements must be made locals and the flag do_imports=False must be
added to prevent the imported Python module from being compiled by geninterp.


Modified: pypy/dist/pypy/module/recparser/pyparser.py
==============================================================================
--- pypy/dist/pypy/module/recparser/pyparser.py	(original)
+++ pypy/dist/pypy/module/recparser/pyparser.py	Sun May  8 10:35:12 2005
@@ -72,21 +72,23 @@
 ASTType = STType
 
 app = applevel(""" 
-    import compiler 
     def mycompile(tup, filename): 
+        import compiler 
         transformer = compiler.transformer.Transformer()
         compileAST = transformer.compile_node(tup) 
         compiler.misc.set_filename(filename, compileAST)
         return compileAST 
 
     def exprcompile(compileAST): 
+        import compiler
         gen = compiler.pycodegen.ExpressionCodeGenerator(compileAST)
         return gen.getCode()
 
     def modcompile(compileAST): 
+        import compiler
         gen = compiler.pycodegen.ModuleCodeGenerator(compileAST)
         return gen.getCode() 
-""", filename=__file__)
+""", filename=__file__, do_imports=False)
 
 mycompile = app.interphook("mycompile")
 exprcompile = app.interphook("exprcompile")



More information about the Pypy-commit mailing list