Commit d7823f26 authored by Guido van Rossum's avatar Guido van Rossum

Vladimir Marangozov:

Avoid calling the dealloc function, previously triggered with
DECREF(inst).  This caused a segfault in PyDict_GetItem, called with a
NULL dict, whenever inst->in_dict fails under low-memory conditions.
parent 98626cd7
......@@ -489,13 +489,13 @@ PyInstance_New(class, arg, kw)
inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
if (inst == NULL)
return NULL;
Py_INCREF(class);
inst->in_class = (PyClassObject *)class;
inst->in_dict = PyDict_New();
if (inst->in_dict == NULL) {
Py_DECREF(inst);
PyObject_DEL(inst);
return NULL;
}
Py_INCREF(class);
inst->in_class = (PyClassObject *)class;
if (initstr == NULL)
initstr = PyString_InternFromString("__init__");
init = instance_getattr2(inst, initstr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment