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

arigo at codespeak.net arigo at codespeak.net
Sun Jul 23 14:56:24 CEST 2006


Author: arigo
Date: Sun Jul 23 14:56:23 2006
New Revision: 30396

Modified:
   pypy/dist/pypy/rpython/rtyper.py
Log:
Made class RPythonTyper new-style, and fix a problem with that.


Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py	(original)
+++ pypy/dist/pypy/rpython/rtyper.py	Sun Jul 23 14:56:23 2006
@@ -34,7 +34,7 @@
                                     ObjectOrientedTypeSystem
 
 
-class RPythonTyper:
+class RPythonTyper(object):
 
     def __init__(self, annotator, type_system="lltype"):
         self.annotator = annotator
@@ -523,22 +523,26 @@
     # __________ regular operations __________
 
     def _registeroperations(cls, model):
-        ns = cls.__dict__
+        d = {}
         # All unary operations
         for opname in model.UNARY_OPERATIONS:
+            fnname = 'translate_op_' + opname
             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(), ns
+                """ % (opname, opname)) in globals(), d
+            setattr(cls, fnname, d[fnname])
         # All binary operations
         for opname in model.BINARY_OPERATIONS:
+            fnname = 'translate_op_' + opname
             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(), ns
+                """ % (opname, opname)) in globals(), d
+            setattr(cls, fnname, d[fnname])
     _registeroperations = classmethod(_registeroperations)
 
     # this one is not in BINARY_OPERATIONS



More information about the Pypy-commit mailing list