Commit 795c7e0d authored by Philip Jenvey's avatar Philip Jenvey

fix bound classmethods lacking an im_class

parent 9a1ac7a4
...@@ -616,7 +616,8 @@ class ClassMethod(W_Root): ...@@ -616,7 +616,8 @@ class ClassMethod(W_Root):
def descr_classmethod_get(self, space, w_obj, w_klass=None): def descr_classmethod_get(self, space, w_obj, w_klass=None):
if space.is_none(w_klass): if space.is_none(w_klass):
w_klass = space.type(w_obj) w_klass = space.type(w_obj)
return space.wrap(Method(space, self.w_function, w_klass, space.w_None)) return space.wrap(Method(space, self.w_function, w_klass,
space.type(w_klass)))
def descr_classmethod__new__(space, w_subtype, w_function): def descr_classmethod__new__(space, w_subtype, w_function):
instance = space.allocate_instance(ClassMethod, w_subtype) instance = space.allocate_instance(ClassMethod, w_subtype)
......
...@@ -388,6 +388,13 @@ class AppTestTypeDef: ...@@ -388,6 +388,13 @@ class AppTestTypeDef:
# differs from .im_class in case the method is # differs from .im_class in case the method is
# defined in some parent class of l's actual class # defined in some parent class of l's actual class
def test_classmethod_im_class(self):
class Foo(object):
@classmethod
def bar(cls):
pass
assert Foo.bar.im_class is type
def test_func_closure(self): def test_func_closure(self):
x = 2 x = 2
def f(): def f():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment