Mailing List Archive

CVS: python/dist/src/Objects dictobject.c,2.76.2.1,2.76.2.2 listobject.c,2.92.4.1,2.92.4.2 tupleobject.c,2.48.4.3,2.48.4.4
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv16019/Objects

Modified Files:
Tag: release21-maint
dictobject.c listobject.c tupleobject.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: dictobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v
retrieving revision 2.76.2.1
retrieving revision 2.76.2.2
diff -C2 -d -r2.76.2.1 -r2.76.2.2
*** dictobject.c 23 May 2001 15:07:55 -0000 2.76.2.1
--- dictobject.c 28 Mar 2002 20:41:02 -0000 2.76.2.2
***************
*** 620,625 ****
register int i;
register dictentry *ep;
- Py_TRASHCAN_SAFE_BEGIN(mp)
PyObject_GC_Fini(mp);
for (i = 0, ep = mp->ma_table; i < mp->ma_size; i++, ep++) {
if (ep->me_key != NULL) {
--- 620,625 ----
register int i;
register dictentry *ep;
PyObject_GC_Fini(mp);
+ Py_TRASHCAN_SAFE_BEGIN(mp)
for (i = 0, ep = mp->ma_table; i < mp->ma_size; i++, ep++) {
if (ep->me_key != NULL) {

Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.92.4.1
retrieving revision 2.92.4.2
diff -C2 -d -r2.92.4.1 -r2.92.4.2
*** listobject.c 6 Jul 2001 17:48:47 -0000 2.92.4.1
--- listobject.c 28 Mar 2002 20:41:02 -0000 2.92.4.2
***************
*** 177,182 ****
{
int i;
- Py_TRASHCAN_SAFE_BEGIN(op)
PyObject_GC_Fini(op);
if (op->ob_item != NULL) {
/* Do it backwards, for Christian Tismer.
--- 177,182 ----
{
int i;
PyObject_GC_Fini(op);
+ Py_TRASHCAN_SAFE_BEGIN(op)
if (op->ob_item != NULL) {
/* Do it backwards, for Christian Tismer.

Index: tupleobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v
retrieving revision 2.48.4.3
retrieving revision 2.48.4.4
diff -C2 -d -r2.48.4.3 -r2.48.4.4
*** tupleobject.c 6 Jul 2001 17:48:47 -0000 2.48.4.3
--- tupleobject.c 28 Mar 2002 20:41:02 -0000 2.48.4.4
***************
*** 144,149 ****
register int i;
register int len = op->ob_size;
- Py_TRASHCAN_SAFE_BEGIN(op)
PyObject_GC_Fini(op);
if (len > 0) {
i = len;
--- 144,149 ----
register int i;
register int len = op->ob_size;
PyObject_GC_Fini(op);
+ Py_TRASHCAN_SAFE_BEGIN(op)
if (len > 0) {
i = len;