Mailing List Archive

CVS: python/dist/src/Modules gcmodule.c,2.15.6.1,2.15.6.2
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv16019/Modules

Modified Files:
Tag: release21-maint
gcmodule.c
Log Message:
Sort-of backport to 2.1.3 (if we ever release it) of the following.
(The fix looks different, but does the same thing to the 2.1 GC code
that Neil's patch does to the 2.2 GC code.)

This is Neil's fix for SF bug 535905 (Evil Trashcan and GC interaction).

The fix makes it possible to call PyObject_GC_UnTrack() more than once
on the same object, and then move the PyObject_GC_UnTrack() call to
*before* the trashcan code is invoked.

BUGFIX CANDIDATE!


Index: gcmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v
retrieving revision 2.15.6.1
retrieving revision 2.15.6.2
diff -C2 -d -r2.15.6.1 -r2.15.6.2
*** gcmodule.c 1 Nov 2001 15:34:20 -0000 2.15.6.1
--- gcmodule.c 28 Mar 2002 20:41:02 -0000 2.15.6.2
***************
*** 88,97 ****
gc_list_remove(PyGC_Head *node)
{
node->gc_prev->gc_next = node->gc_next;
node->gc_next->gc_prev = node->gc_prev;
#ifdef Py_DEBUG
node->gc_prev = NULL;
- node->gc_next = NULL;
#endif
}

--- 88,99 ----
gc_list_remove(PyGC_Head *node)
{
+ if (node->gc_next == NULL)
+ return;
node->gc_prev->gc_next = node->gc_next;
node->gc_next->gc_prev = node->gc_prev;
#ifdef Py_DEBUG
node->gc_prev = NULL;
#endif
+ node->gc_next = NULL;
}