[pypy-svn] r20286 - pypy/branch/somepbc-refactoring/pypy/annotation

arigo at codespeak.net arigo at codespeak.net
Sat Nov 26 18:43:42 CET 2005


Author: arigo
Date: Sat Nov 26 18:43:41 2005
New Revision: 20286

Modified:
   pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py
   pypy/branch/somepbc-refactoring/pypy/annotation/description.py
Log:
(pedronis, arigo)

restored staticmethod support.



Modified: pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py	Sat Nov 26 18:43:41 2005
@@ -346,7 +346,7 @@
             result = SomeOOClass(x._INSTANCE)   # NB. can be None
         elif isinstance(x, ootype._instance):
             result = SomeOOInstance(ootype.typeOf(x))
-        elif callable(x) or isinstance(x, staticmethod): # XXX
+        elif callable(x):
             if hasattr(x, '__self__') and x.__self__ is not None:
                 # for cases like 'l.append' where 'l' is a global constant list
                 s_self = self.immutablevalue(x.__self__)

Modified: pypy/branch/somepbc-refactoring/pypy/annotation/description.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/annotation/description.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/annotation/description.py	Sat Nov 26 18:43:41 2005
@@ -412,7 +412,11 @@
     def s_get_value(self, classdef, name):
         obj = self.classdict[name]
         if isinstance(obj, Constant):
-            s_value = self.bookkeeper.immutablevalue(obj.value)
+            value = obj.value
+            if isinstance(value, staticmethod):   # special case
+                value = value.__get__(42)
+                classdef = None   # don't bind
+            s_value = self.bookkeeper.immutablevalue(value)
             if classdef is not None:
                 s_value = s_value.bind_callables_under(classdef, name)
         elif isinstance(obj, Desc):



More information about the Pypy-commit mailing list