Mercurial > cpython-lru_cache-weakref
diff Objects/classobject.c @ 34845:cd2c044f699d legacy-trunk
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.
| author | Michael W. Hudson <mwh@python.net> |
|---|---|
| date | Wed, 30 Mar 2005 16:32:10 +0000 |
| parents | aef713de7a23 |
| children | 77571f71b3e6 ab83ab27c837 |
line wrap: on
line diff
--- a/Objects/classobject.c Wed Mar 30 16:25:34 2005 +0000 +++ b/Objects/classobject.c Wed Mar 30 16:32:10 2005 +0000 @@ -2208,6 +2208,12 @@ } 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); }
