[pypy-svn] r32681 - in pypy/dist/pypy: objspace/cpy rpython

arigo at codespeak.net arigo at codespeak.net
Wed Sep 27 21:03:06 CEST 2006


Author: arigo
Date: Wed Sep 27 21:03:04 2006
New Revision: 32681

Modified:
   pypy/dist/pypy/objspace/cpy/appsupport.py
   pypy/dist/pypy/rpython/annlowlevel.py
   pypy/dist/pypy/rpython/extregistry.py
Log:
(pedronis, arre, arigo) 
Clean-up: extregistry entries can assume that they always have a bookkeeper
during annotation, nowadays.


Modified: pypy/dist/pypy/objspace/cpy/appsupport.py
==============================================================================
--- pypy/dist/pypy/objspace/cpy/appsupport.py	(original)
+++ pypy/dist/pypy/objspace/cpy/appsupport.py	Wed Sep 27 21:03:04 2006
@@ -36,9 +36,7 @@
     _type_ = W_AppLevel
 
     def compute_annotation(self):
-        from pypy.annotation.bookkeeper import getbookkeeper
-        bk = getbookkeeper()
-        return lookup_type(W_Object).compute_annotation()
+        return lookup_type(W_Object).compute_annotation_bk(self.bookkeeper)
 
     def genc_pyobj(self, pyobjmaker):
         dictname = pyobjmaker.nameof(self.instance.w_moddict)
@@ -51,9 +49,7 @@
     _type_ = W_AppLevelModDict
 
     def compute_annotation(self):
-        from pypy.annotation.bookkeeper import getbookkeeper
-        bk = getbookkeeper()
-        return lookup_type(W_Object).compute_annotation()
+        return lookup_type(W_Object).compute_annotation_bk(self.bookkeeper)
 
     def genc_pyobj(self, pyobjmaker):
         import marshal

Modified: pypy/dist/pypy/rpython/annlowlevel.py
==============================================================================
--- pypy/dist/pypy/rpython/annlowlevel.py	(original)
+++ pypy/dist/pypy/rpython/annlowlevel.py	Wed Sep 27 21:03:04 2006
@@ -322,11 +322,10 @@
         assert s_F.is_constant()
         assert s_callable.is_constant()
         F = s_F.const
-        if hasattr(self, 'bookkeeper'):
-            args_s = [annmodel.lltype_to_annotation(T) for T in F.TO.ARGS]
-            key = (llhelper, s_callable.const)
-            s_res = self.bookkeeper.emulate_pbc_call(key, s_callable, args_s)
-            assert annmodel.lltype_to_annotation(F.TO.RESULT).contains(s_res)
+        args_s = [annmodel.lltype_to_annotation(T) for T in F.TO.ARGS]
+        key = (llhelper, s_callable.const)
+        s_res = self.bookkeeper.emulate_pbc_call(key, s_callable, args_s)
+        assert annmodel.lltype_to_annotation(F.TO.RESULT).contains(s_res)
         return annmodel.SomePtr(F)
 
     def specialize_call(self, hop):

Modified: pypy/dist/pypy/rpython/extregistry.py
==============================================================================
--- pypy/dist/pypy/rpython/extregistry.py	(original)
+++ pypy/dist/pypy/rpython/extregistry.py	Wed Sep 27 21:03:04 2006
@@ -97,8 +97,9 @@
         return self.compute_annotation()
 
     def compute_annotation(self):
+        # callers should always use compute_annotation_bk()!
         # default implementation useful for built-in functions,
-        # can be overriden
+        # can be overriden.
         func = self.instance
         assert func is not None
         from pypy.annotation import model as annmodel



More information about the Pypy-commit mailing list