mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fix for SF bug 528132 (Armin Rigo): classmethod().__get__() segfault
The proper fix is not quite what was submitted; it's really better to take the class of the object passed rather than calling PyMethod_New with NULL pointer args, because that can then cause other core dumps later. I also added a testcase for the fix to classmethods() in test_descr.py. I've already applied this to the 2.2 branch.
This commit is contained in:
parent
c99475e7a0
commit
7e30548285
2 changed files with 7 additions and 0 deletions
|
@ -474,6 +474,8 @@ cm_descr_get(PyObject *self, PyObject *obj, PyObject *type)
|
|||
"uninitialized classmethod object");
|
||||
return NULL;
|
||||
}
|
||||
if (type == NULL)
|
||||
type = (PyObject *)(obj->ob_type);
|
||||
return PyMethod_New(cm->cm_callable,
|
||||
type, (PyObject *)(type->ob_type));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue