[pypy-svn] r63665 - pypy/branch/pyjitpl5-simplify/pypy/annotation

fijal at codespeak.net fijal at codespeak.net
Sun Apr 5 06:07:49 CEST 2009


Author: fijal
Date: Sun Apr  5 06:07:48 2009
New Revision: 63665

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/annotation/annrpython.py
   pypy/branch/pyjitpl5-simplify/pypy/annotation/specialize.py
Log:
ok, someone had to do it. use py.code.Source instead of bare strings
in exec in annotator


Modified: pypy/branch/pyjitpl5-simplify/pypy/annotation/annrpython.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/annotation/annrpython.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/annotation/annrpython.py	Sun Apr  5 06:07:48 2009
@@ -768,18 +768,18 @@
         d = {}
         for opname in model.UNARY_OPERATIONS:
             fnname = 'consider_op_' + opname
-            exec """
+            exec py.code.Source("""
 def consider_op_%s(self, arg, *args):
     return arg.%s(*args)
-""" % (opname, opname) in globals(), d
+""" % (opname, opname)).compile() in globals(), d
             setattr(cls, fnname, d[fnname])
         # All binary operations
         for opname in model.BINARY_OPERATIONS:
             fnname = 'consider_op_' + opname
-            exec """
+            exec py.code.Source("""
 def consider_op_%s(self, arg1, arg2, *args):
     return pair(arg1,arg2).%s(*args)
-""" % (opname, opname) in globals(), d
+""" % (opname, opname)).compile() in globals(), d
             setattr(cls, fnname, d[fnname])
     _registeroperations = classmethod(_registeroperations)
 

Modified: pypy/branch/pyjitpl5-simplify/pypy/annotation/specialize.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/annotation/specialize.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/annotation/specialize.py	Sun Apr  5 06:07:48 2009
@@ -423,7 +423,7 @@
         else:
             computed_v = v
         miniglobals = {'v': computed_v, '__name__': srcmodule}
-        exec "constf = lambda %s: v" % args in miniglobals
+        exec py.code.Source("constf = lambda %s: v").compile() % args in miniglobals
         return translator.buildflowgraph(miniglobals['constf'])
     return constgraphbuilder
 



More information about the Pypy-commit mailing list