diff Objects/structseq.c @ 37745:353fe06dab5b legacy-trunk

Unlink the structseq type from the global list of objects before initializing it. It might be linked already if there was a Py_Initialize/Py_Finalize cycle earlier; not unlinking it would break the global list.
author Martin v. Löwis <martin@v.loewis.de>
date Sat, 15 Apr 2006 12:45:05 +0000
parents 79a0f080f898
children e11caad7e029
line wrap: on
line diff
--- a/Objects/structseq.c	Sat Apr 15 08:41:11 2006 +0000
+++ b/Objects/structseq.c	Sat Apr 15 12:45:05 2006 +0000
@@ -349,6 +349,14 @@
 	PyMemberDef* members;
 	int n_members, n_unnamed_members, i, k;
 
+#ifdef Py_TRACE_REFS
+	/* if the type object was chained, unchain it first
+	   before overwriting its storage */
+	if (type->_ob_next) {
+		_Py_ForgetReference((PyObject*)type);
+	}
+#endif
+
 	n_unnamed_members = 0;
 	for (i = 0; desc->fields[i].name != NULL; ++i)
 		if (desc->fields[i].name == PyStructSequence_UnnamedField)