self.assertEqual(Class().inner(), 'spam')
self.assertEqual(Class().outer(), 'eggs')
+ def test_bound_function_inside_classmethod(self):
+ class A:
+ def foo(self, cls):
+ return 'spam'
+
+ class B:
+ bar = classmethod(A().foo)
+
+ self.assertEqual(B.bar(), 'spam')
+
def test_wrapped_classmethod_inside_classmethod(self):
class MyClassMethod1:
def __init__(self, func):
return 0;
}
-static PyObject *
-method_descr_get(PyObject *meth, PyObject *obj, PyObject *cls)
-{
- Py_INCREF(meth);
- return meth;
-}
-
PyTypeObject PyMethod_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
.tp_name = "method",
.tp_methods = method_methods,
.tp_members = method_memberlist,
.tp_getset = method_getset,
- .tp_descr_get = method_descr_get,
.tp_new = method_new,
};