diff Objects/tupleobject.c @ 57665:2ffd19a224d4 legacy-trunk

Issue #7466: segmentation fault when the garbage collector is called in the middle of populating a tuple. Patch by Florent Xicluna. (note: no NEWS entry for trunk since the bug was introduced in 2.7/3.1)
author Antoine Pitrou <solipsis@pitrou.net>
date Sat, 12 Dec 2009 19:13:08 +0000
parents b3791309e690
children 1c6fc70f49d1
line wrap: on
line diff
--- a/Objects/tupleobject.c	Fri Dec 11 17:29:33 2009 +0000
+++ b/Objects/tupleobject.c	Sat Dec 12 19:13:08 2009 +0000
@@ -875,7 +875,8 @@
 
 	/* XXX UNREF/NEWREF interface should be more symmetrical */
 	_Py_DEC_REFTOTAL;
-	_PyObject_GC_UNTRACK(v);
+	if (_PyObject_GC_IS_TRACKED(v))
+		_PyObject_GC_UNTRACK(v);
 	_Py_ForgetReference((PyObject *) v);
 	/* DECREF items deleted by shrinkage */
 	for (i = newsize; i < oldsize; i++) {