Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3550a6

Browse files
committed
- fix a GC bug caused by malloc() failing
1 parent 15f0666 commit e3550a6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Objects/classobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,14 +437,14 @@ PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw)
437437
if (inst == NULL)
438438
return NULL;
439439
inst->in_dict = PyDict_New();
440-
PyObject_GC_Init(inst);
441440
if (inst->in_dict == NULL) {
442441
inst = (PyInstanceObject *) PyObject_AS_GC(inst);
443442
PyObject_DEL(inst);
444443
return NULL;
445444
}
446445
Py_INCREF(class);
447446
inst->in_class = (PyClassObject *)class;
447+
PyObject_GC_Init(inst);
448448
if (initstr == NULL)
449449
initstr = PyString_InternFromString("__init__");
450450
init = instance_getattr2(inst, initstr);

0 commit comments

Comments
 (0)