Commit 0be32c20 authored by Neil Schemenauer's avatar Neil Schemenauer

- fix a GC bug caused by malloc() failing

parent 355b94f6
...@@ -437,7 +437,6 @@ PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw) ...@@ -437,7 +437,6 @@ PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw)
if (inst == NULL) if (inst == NULL)
return NULL; return NULL;
inst->in_dict = PyDict_New(); inst->in_dict = PyDict_New();
PyObject_GC_Init(inst);
if (inst->in_dict == NULL) { if (inst->in_dict == NULL) {
inst = (PyInstanceObject *) PyObject_AS_GC(inst); inst = (PyInstanceObject *) PyObject_AS_GC(inst);
PyObject_DEL(inst); PyObject_DEL(inst);
...@@ -445,6 +444,7 @@ PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw) ...@@ -445,6 +444,7 @@ PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw)
} }
Py_INCREF(class); Py_INCREF(class);
inst->in_class = (PyClassObject *)class; inst->in_class = (PyClassObject *)class;
PyObject_GC_Init(inst);
if (initstr == NULL) if (initstr == NULL)
initstr = PyString_InternFromString("__init__"); initstr = PyString_InternFromString("__init__");
init = instance_getattr2(inst, initstr); 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