[pypy-svn] r74042 - in pypy/trunk/pypy/annotation: . test

benjamin at codespeak.net benjamin at codespeak.net
Sat Apr 24 23:47:10 CEST 2010


Author: benjamin
Date: Sat Apr 24 23:47:08 2010
New Revision: 74042

Modified:
   pypy/trunk/pypy/annotation/description.py
   pypy/trunk/pypy/annotation/test/test_annrpython.py
Log:
explode sooner rather than later on class methods

Modified: pypy/trunk/pypy/annotation/description.py
==============================================================================
--- pypy/trunk/pypy/annotation/description.py	(original)
+++ pypy/trunk/pypy/annotation/description.py	Sat Apr 24 23:47:08 2010
@@ -595,6 +595,8 @@
             if isinstance(value, staticmethod):   # special case
                 value = value.__get__(42)
                 classdef = None   # don't bind
+            elif isinstance(value, classmethod):
+                raise AssertionError("classmethods are not supported")
             s_value = self.bookkeeper.immutablevalue(value)
             if classdef is not None:
                 s_value = s_value.bind_callables_under(classdef, name)

Modified: pypy/trunk/pypy/annotation/test/test_annrpython.py
==============================================================================
--- pypy/trunk/pypy/annotation/test/test_annrpython.py	(original)
+++ pypy/trunk/pypy/annotation/test/test_annrpython.py	Sat Apr 24 23:47:08 2010
@@ -234,6 +234,16 @@
         s = a.build_types(f, [int])
         assert isinstance(s, annmodel.SomeInteger)
 
+    def test_classmethod(self):
+        class X(object):
+            @classmethod
+            def meth(cls):
+                return None
+        def f():
+            return X().meth()
+        a = self.RPythonAnnotator()
+        py.test.raises(AssertionError, a.build_types, f,  [])
+
     def test_methodcall1(self):
         a = self.RPythonAnnotator()
         s = a.build_types(snippet._methodcall1, [int])



More information about the Pypy-commit mailing list