Mercurial > cpython-lru_cache-weakref
diff Objects/funcobject.c @ 29526:f6d503de45bd legacy-trunk
SF bug #753451: classmethod abuse --> SystemError
Check the argument to classmethod for callability.
Backport candidate.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Wed, 18 Jun 2003 01:13:41 +0000 |
| parents | 41388e84261b |
| children | d448cc261f69 |
line wrap: on
line diff
--- a/Objects/funcobject.c Wed Jun 18 00:54:28 2003 +0000 +++ b/Objects/funcobject.c Wed Jun 18 01:13:41 2003 +0000 @@ -640,6 +640,12 @@ 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;
