SF bug #753451: classmethod abuse --> SystemError

Check the argument to classmethod for callability.

Backport candidate.
This commit is contained in:
Raymond Hettinger 2003-06-18 01:13:41 +00:00
parent 9b15878369
commit be9715398b
2 changed files with 14 additions and 0 deletions

View file

@ -640,6 +640,12 @@ cm_init(PyObject *self, PyObject *args, PyObject *kwds)
if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &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;