Check the argument of classmethod is callable. (prevents
classmethod(classmethod(func)) from bombing out.
vereq(super(D,D).goo(), (D,))
vereq(super(D,d).goo(), (D,))
+ # Verify that argument is checked for callability (SF bug 753451)
+ try:
+ classmethod(1).__get__(1)
+ except TypeError:
+ pass
+ else:
+ raise TestFailed, "classmethod should check for callability"
+
def staticmethods():
if verbose: print "Testing static methods..."
class C(object):
if (!PyArg_ParseTuple(args, "O:callable", &callable))
return -1;
+ if (!PyCallable_Check(callable)) {
+ PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
+ callable->ob_type->tp_name);
+ return -1;
+ }
+
Py_INCREF(callable);
cm->cm_callable = callable;
return 0;