[pypy-svn] r52518 - pypy/branch/jit-hotpath/pypy/annotation

arigo at codespeak.net arigo at codespeak.net
Fri Mar 14 17:37:52 CET 2008


Author: arigo
Date: Fri Mar 14 17:37:51 2008
New Revision: 52518

Modified:
   pypy/branch/jit-hotpath/pypy/annotation/description.py
Log:
Obscure annotator bug: don't attach _annenforceargs_ back to the real
function object!  It explodes confusingly if the function object has
many specialized version because _annenforceargs_ then shows up on the
other versions as well...


Modified: pypy/branch/jit-hotpath/pypy/annotation/description.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/annotation/description.py	(original)
+++ pypy/branch/jit-hotpath/pypy/annotation/description.py	Fri Mar 14 17:37:51 2008
@@ -166,6 +166,7 @@
 class FunctionDesc(Desc):
     knowntype = types.FunctionType
     overridden = False
+    enforceargs = None
     
     def __init__(self, bookkeeper, pyobj=None,
                  name=None, signature=None, defaults=None,
@@ -252,12 +253,13 @@
             tag = getattr(self.pyobj, '_annspecialcase_', None)
             policy = self.bookkeeper.annotator.policy
             self.specializer = policy.get_specializer(tag)
-        enforceargs = getattr(self.pyobj, '_annenforceargs_', None)
+        enforceargs = (self.enforceargs or
+                       getattr(self.pyobj, '_annenforceargs_', None))
         if enforceargs:
             if not callable(enforceargs):
                 from pypy.annotation.policy import Sig
                 enforceargs = Sig(*enforceargs)
-                self.pyobj._annenforceargs_ = enforceargs
+                self.enforceargs = enforceargs
             enforceargs(self, inputcells) # can modify inputcells in-place
         return self.specializer(self, inputcells)
 



More information about the Pypy-commit mailing list