summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2005-03-31 10:22:43 (GMT)
committerMichael W. Hudson <mwh@python.net>2005-03-31 10:22:43 (GMT)
commit21f898741e7db155cf46ec2ed61c346d4ad14261 (patch)
tree14716591a099a1346b06f4acd5678c48fff577a2 /Objects
parent59f9bea8738b5811650c53961d9a6036c3b9bcbe (diff)
downloadcpython-21f898741e7db155cf46ec2ed61c346d4ad14261.zip
cpython-21f898741e7db155cf46ec2ed61c346d4ad14261.tar.gz
cpython-21f898741e7db155cf46ec2ed61c346d4ad14261.tar.bz2
Backport:
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')
-rw-r--r--Objects/classobject.c6
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);
}