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.
This commit is contained in:
Guido van Rossum 2000-06-28 23:46:07 +00:00
parent 98626cd7ac
commit d7823f2645
1 changed files with 3 additions and 3 deletions

View File

@ -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);