diff options
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r-- | Objects/funcobject.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 8f2d8df..c414bca 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -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; |