summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-06-18 01:13:41 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-06-18 01:13:41 (GMT)
commitbe9715398b87df269d0781a7c436e10cfa4a0ea4 (patch)
tree21609b835a4f88dddbceb78205b26b20cfb5f8e6 /Objects
parent9b1587836992c460d213b9bbc6f539516139bdf2 (diff)
downloadcpython-be9715398b87df269d0781a7c436e10cfa4a0ea4.zip
cpython-be9715398b87df269d0781a7c436e10cfa4a0ea4.tar.gz
cpython-be9715398b87df269d0781a7c436e10cfa4a0ea4.tar.bz2
SF bug #753451: classmethod abuse --> SystemError
Check the argument to classmethod for callability. Backport candidate.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/funcobject.c6
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;