[pypy-svn] r36727 - in pypy/dist/pypy/rpython: . ootypesystem

fijal at codespeak.net fijal at codespeak.net
Sun Jan 14 13:07:55 CET 2007


Author: fijal
Date: Sun Jan 14 13:07:52 2007
New Revision: 36727

Modified:
   pypy/dist/pypy/rpython/ootypesystem/bltregistry.py
   pypy/dist/pypy/rpython/ootypesystem/extdesc.py
   pypy/dist/pypy/rpython/rexternalobj.py
Log:
Hopefully last checkin regarding an external object refactoring. At least tests
passes now :-]


Modified: pypy/dist/pypy/rpython/ootypesystem/bltregistry.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/bltregistry.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/bltregistry.py	Sun Jan 14 13:07:52 2007
@@ -127,10 +127,8 @@
         _signs = {}
         self._fields = {}
         for i, val in _methods.iteritems():
-            #s_retval =
-            val.check_update()
             retval = annotation(val.retval._type)
-            values = [arg._type for arg in val.args]
+            values = [annotation(arg._type) for arg in val.args]
             s_args = [j for j in values]
             _signs[i] = MethodDesc(tuple(s_args), retval)
             next = annmodel.SomeBuiltin(Analyzer(i, val, retval, s_args), s_self = annmodel.SomeExternalBuiltin(self), methodname = i)

Modified: pypy/dist/pypy/rpython/ootypesystem/extdesc.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/extdesc.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/extdesc.py	Sun Jan 14 13:07:52 2007
@@ -15,9 +15,6 @@
     def __repr__(self):
         return "<ArgDesc %s: %s>" % (self.name, self._type)
 
-    def update(self):
-        return ArgDesc(self.name, annotation(self._type))
-
 class MethodDesc(object):
     """ Description of method to be external,
     args are taken from examples given as keyword arguments or as args,
@@ -28,7 +25,6 @@
         self.args = [self.convert_val(arg) for arg in args]
         self.retval = self.convert_val(retval)
         self.example = self
-        self.updated = False
     
     def convert_val(self, val):
         if isinstance(val, ArgDesc) or isinstance(val, MethodDesc):
@@ -39,11 +35,5 @@
             self.num += 1
             return ArgDesc('v%d' % (self.num-1), val)
 
-    def check_update(self):
-        if not self.updated:
-            self.args = [i.update() for i in self.args]
-            self.retval = self.retval.update()
-            self.updated = True
-    
     def __repr__(self):
         return "<MethodDesc (%r)>" % (self.args,)

Modified: pypy/dist/pypy/rpython/rexternalobj.py
==============================================================================
--- pypy/dist/pypy/rpython/rexternalobj.py	(original)
+++ pypy/dist/pypy/rpython/rexternalobj.py	Sun Jan 14 13:07:52 2007
@@ -68,11 +68,8 @@
     def call_method(self, name, hop):
         bookkeeper = hop.rtyper.annotator.bookkeeper
         args_r = []
-        for num, arg_desc in enumerate(self.knowntype._class_._methods[name].args):
-            s_v = arg_desc._type
-#            if isinstance(s_v, annmodel.SomeGenericCallable):
-#                import pdb;pdb.set_trace()
-            r = hop.rtyper.getrepr(s_v)
+        for s_arg in self.knowntype._fields[name].analyser.s_args:
+            r = hop.rtyper.getrepr(s_arg)
             r.setup()
             args_r.append(r)
         vlist = hop.inputargs(self, *args_r)



More information about the Pypy-commit mailing list