diff Objects/classobject.c @ 15010:c5cf6fba54dd legacy-trunk

- fix a GC bug caused by malloc() failing
author Neil Schemenauer <nascheme@enme.ucalgary.ca>
date Wed, 04 Oct 2000 16:20:41 +0000
parents 3d6fe64bcd21
children 8aa947e1eee8
line wrap: on
line diff
--- a/Objects/classobject.c	Wed Oct 04 13:59:52 2000 +0000
+++ b/Objects/classobject.c	Wed Oct 04 16:20:41 2000 +0000
@@ -437,7 +437,6 @@
 	if (inst == NULL)
 		return NULL;
 	inst->in_dict = PyDict_New();
-	PyObject_GC_Init(inst);
 	if (inst->in_dict == NULL) {
 		inst = (PyInstanceObject *) PyObject_AS_GC(inst);
 		PyObject_DEL(inst);
@@ -445,6 +444,7 @@
 	}
 	Py_INCREF(class);
 	inst->in_class = (PyClassObject *)class;
+	PyObject_GC_Init(inst);
 	if (initstr == NULL)
 		initstr = PyString_InternFromString("__init__");
 	init = instance_getattr2(inst, initstr);