[pypy-svn] r56068 - pypy/branch/oo-jit/pypy/annotation

antocuni at codespeak.net antocuni at codespeak.net
Wed Jun 25 16:04:59 CEST 2008


Author: antocuni
Date: Wed Jun 25 16:04:59 2008
New Revision: 56068

Modified:
   pypy/branch/oo-jit/pypy/annotation/annrpython.py
Log:
use py.code.Source instead of a plain exec



Modified: pypy/branch/oo-jit/pypy/annotation/annrpython.py
==============================================================================
--- pypy/branch/oo-jit/pypy/annotation/annrpython.py	(original)
+++ pypy/branch/oo-jit/pypy/annotation/annrpython.py	Wed Jun 25 16:04:59 2008
@@ -770,18 +770,20 @@
         d = {}
         for opname in model.UNARY_OPERATIONS:
             fnname = 'consider_op_' + opname
-            exec """
+            src = py.code.Source("""
 def consider_op_%s(self, arg, *args):
     return arg.%s(*args)
-""" % (opname, opname) in globals(), d
+""" % (opname, opname))
+            exec src.compile() in globals(), d
             setattr(cls, fnname, d[fnname])
         # All binary operations
         for opname in model.BINARY_OPERATIONS:
             fnname = 'consider_op_' + opname
-            exec """
+            src = py.code.Source("""
 def consider_op_%s(self, arg1, arg2, *args):
     return pair(arg1,arg2).%s(*args)
-""" % (opname, opname) in globals(), d
+""" % (opname, opname))
+            exec src.compile() in globals(), d
             setattr(cls, fnname, d[fnname])
     _registeroperations = classmethod(_registeroperations)
 



More information about the Pypy-commit mailing list