Mailing List Archive

CVS: python/dist/src/Objects dictobject.c,2.120,2.121 frameobject.c,2.59,2.60 listobject.c,2.103,2.104 tupleobject.c,2.62,2.63
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv13618/Objects

Modified Files:
dictobject.c frameobject.c listobject.c tupleobject.c
Log Message:
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.120
retrieving revision 2.121
diff -C2 -d -r2.120 -r2.121
*** dictobject.c 22 Mar 2002 15:26:09 -0000 2.120
--- dictobject.c 28 Mar 2002 20:34:58 -0000 2.121
***************
*** 695,700 ****
register dictentry *ep;
int fill = mp->ma_fill;
Py_TRASHCAN_SAFE_BEGIN(mp)
- _PyObject_GC_UNTRACK(mp);
for (ep = mp->ma_table; fill > 0; ep++) {
if (ep->me_key) {
--- 695,700 ----
register dictentry *ep;
int fill = mp->ma_fill;
+ PyObject_GC_UnTrack(mp);
Py_TRASHCAN_SAFE_BEGIN(mp)
for (ep = mp->ma_table; fill > 0; ep++) {
if (ep->me_key) {

Index: frameobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v
retrieving revision 2.59
retrieving revision 2.60
diff -C2 -d -r2.59 -r2.60
*** frameobject.c 6 Dec 2001 15:48:16 -0000 2.59
--- frameobject.c 28 Mar 2002 20:34:59 -0000 2.60
***************
*** 68,73 ****
PyObject **p;

Py_TRASHCAN_SAFE_BEGIN(f)
- _PyObject_GC_UNTRACK(f);
/* Kill all local variables */
slots = f->f_nlocals + f->f_ncells + f->f_nfreevars;
--- 68,73 ----
PyObject **p;

+ PyObject_GC_UnTrack(f);
Py_TRASHCAN_SAFE_BEGIN(f)
/* Kill all local variables */
slots = f->f_nlocals + f->f_ncells + f->f_nfreevars;

Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.103
retrieving revision 2.104
diff -C2 -d -r2.103 -r2.104
*** listobject.c 3 Dec 2001 16:32:18 -0000 2.103
--- listobject.c 28 Mar 2002 20:34:59 -0000 2.104
***************
*** 196,201 ****
{
int i;
Py_TRASHCAN_SAFE_BEGIN(op)
- _PyObject_GC_UNTRACK(op);
if (op->ob_item != NULL) {
/* Do it backwards, for Christian Tismer.
--- 196,201 ----
{
int i;
+ PyObject_GC_UnTrack(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.62
retrieving revision 2.63
diff -C2 -d -r2.62 -r2.63
*** tupleobject.c 7 Dec 2001 20:00:04 -0000 2.62
--- tupleobject.c 28 Mar 2002 20:34:59 -0000 2.63
***************
*** 140,145 ****
register int i;
register int len = op->ob_size;
Py_TRASHCAN_SAFE_BEGIN(op)
- _PyObject_GC_UNTRACK(op);
if (len > 0) {
i = len;
--- 140,145 ----
register int i;
register int len = op->ob_size;
+ PyObject_GC_UnTrack(op);
Py_TRASHCAN_SAFE_BEGIN(op)
if (len > 0) {
i = len;