diff Objects/classobject.c @ 17154:3b8a5bbfd2e5 legacy-trunk

A small change to the C API for weakly-referencable types: Such types must now initialize the extra field used by the weak-ref machinery to NULL themselves, to avoid having to require PyObject_INIT() to check if the type supports weak references and do it there. This causes less work to be done for all objects (the type object does not need to be consulted to check for the Py_TPFLAGS_HAVE_WEAKREFS bit).
author Fred Drake <fdrake@acm.org>
date Thu, 22 Mar 2001 18:26:47 +0000
parents d446e4ec9b7b
children 962196ce7231
line wrap: on
line diff
--- a/Objects/classobject.c	Thu Mar 22 18:05:30 2001 +0000
+++ b/Objects/classobject.c	Thu Mar 22 18:26:47 2001 +0000
@@ -453,6 +453,7 @@
 		Py_DECREF(dict);
 		return NULL;
 	}
+	inst->in_weakreflist = NULL;
 	Py_INCREF(klass);
 	inst->in_class = (PyClassObject *)klass;
 	inst->in_dict = dict;