diff options
author | Michael W. Hudson <mwh@python.net> | 2005-03-30 16:32:10 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2005-03-30 16:32:10 (GMT) |
commit | e2749cb264576d97533a85fba1396099606bc986 (patch) | |
tree | 1518a9aae55370c93f5627ec13e1017d2fefe4c7 /Objects/classobject.c | |
parent | 5c473559e56ad1990b4f2e439d0a5b1d3d4f67fc (diff) | |
download | cpython-e2749cb264576d97533a85fba1396099606bc986.zip cpython-e2749cb264576d97533a85fba1396099606bc986.tar.gz cpython-e2749cb264576d97533a85fba1396099606bc986.tar.bz2 |
Fix for rather inaccurately titled bug
[ 1165306 ] Property access with decorator makes interpreter crash
Don't allow the creation of unbound methods with NULL im_class, because
attempting to call such crashes.
Backport candidate.
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r-- | Objects/classobject.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c index 506faab..68505f1 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -2208,6 +2208,12 @@ instancemethod_new(PyTypeObject* type, PyObject* args, PyObject *kw) } if (self == Py_None) self = NULL; + if (self == NULL && classObj == NULL) { + PyErr_SetString(PyExc_TypeError, + "unbound methods must have non-NULL im_class"); + return NULL; + } + return PyMethod_New(func, self, classObj); } |