[pypy-svn] r14332 - pypy/dist/pypy/rpython

hpk at codespeak.net hpk at codespeak.net
Wed Jul 6 15:09:31 CEST 2005


Author: hpk
Date: Wed Jul  6 15:09:31 2005
New Revision: 14332

Modified:
   pypy/dist/pypy/rpython/rtyper.py
Log:
remember dynamically generated code to have better tracebacks 


Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py	(original)
+++ pypy/dist/pypy/rpython/rtyper.py	Wed Jul  6 15:09:31 2005
@@ -308,19 +308,19 @@
     def _registeroperations(loc):
         # All unary operations
         for opname in annmodel.UNARY_OPERATIONS:
-            exec """
-def translate_op_%s(self, hop):
-    r_arg1 = hop.args_r[0]
-    return r_arg1.rtype_%s(hop)
-""" % (opname, opname) in globals(), loc
+            exec py.code.compile("""
+                def translate_op_%s(self, hop):
+                    r_arg1 = hop.args_r[0]
+                    return r_arg1.rtype_%s(hop)
+                """ % (opname, opname)) in globals(), loc
         # All binary operations
         for opname in annmodel.BINARY_OPERATIONS:
-            exec """
-def translate_op_%s(self, hop):
-    r_arg1 = hop.args_r[0]
-    r_arg2 = hop.args_r[1]
-    return pair(r_arg1, r_arg2).rtype_%s(hop)
-""" % (opname, opname) in globals(), loc
+            exec py.code.compile("""
+                def translate_op_%s(self, hop):
+                    r_arg1 = hop.args_r[0]
+                    r_arg2 = hop.args_r[1]
+                    return pair(r_arg1, r_arg2).rtype_%s(hop)
+                """ % (opname, opname)) in globals(), loc
 
     _registeroperations(locals())
     del _registeroperations



More information about the Pypy-commit mailing list