[Python-checkins] r45432 - python/trunk/Objects/structseq.c

martin.v.loewis python-checkins at python.org
Sat Apr 15 14:45:05 CEST 2006


Author: martin.v.loewis
Date: Sat Apr 15 14:45:05 2006
New Revision: 45432

Modified:
   python/trunk/Objects/structseq.c
Log:
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.


Modified: python/trunk/Objects/structseq.c
==============================================================================
--- python/trunk/Objects/structseq.c	(original)
+++ python/trunk/Objects/structseq.c	Sat Apr 15 14:45:05 2006
@@ -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)


More information about the Python-checkins mailing list