mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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.
This commit is contained in:
parent
5c473559e5
commit
e2749cb264
2 changed files with 16 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue