[Python-checkins] python/dist/src/Modules gcmodule.c,2.33.6.7,2.33.6.8
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Tue, 08 Apr 2003 13:33:11 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv21203/Modules
Modified Files:
Tag: release22-maint
gcmodule.c
Log Message:
Fixed the gc-vs-__del__ bugs for new-style classes. That's it for this one.
Index: gcmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v
retrieving revision 2.33.6.7
retrieving revision 2.33.6.8
diff -C2 -d -r2.33.6.7 -r2.33.6.8
*** gcmodule.c 8 Apr 2003 19:13:14 -0000 2.33.6.7
--- gcmodule.c 8 Apr 2003 20:33:05 -0000 2.33.6.8
***************
*** 260,264 ****
* arbitrary Python code, mutating the object graph in arbitrary ways, and
* that was the source of some excruciatingly subtle bugs.
- * XXX This is still broken for new-style classes.
*/
static int
--- 260,263 ----
***************
*** 275,280 ****
return _PyInstance_Lookup(op, delstr) != NULL;
else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE))
! /* XXX This path is still Evil. */
! return PyObject_HasAttr(op, delstr);
else
return 0;
--- 274,278 ----
return _PyInstance_Lookup(op, delstr) != NULL;
else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE))
! return _PyType_Lookup(op->ob_type, delstr) != NULL;
else
return 0;
***************
*** 285,302 ****
move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
{
- PyGC_Head *next;
PyGC_Head *gc = unreachable->gc.gc_next;
! for (; gc != unreachable; gc=next) {
PyObject *op = FROM_GC(gc);
! /* XXX has_finalizer() may result in arbitrary Python
! code being run. */
if (has_finalizer(op)) {
- next = gc->gc.gc_next;
gc_list_remove(gc);
gc_list_append(gc, finalizers);
gc->gc.gc_refs = GC_MOVED;
}
! else
! next = gc->gc.gc_next;
}
}
--- 283,298 ----
move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
{
PyGC_Head *gc = unreachable->gc.gc_next;
!
! while (gc != unreachable) {
! PyGC_Head *next = gc->gc.gc_next;
PyObject *op = FROM_GC(gc);
!
if (has_finalizer(op)) {
gc_list_remove(gc);
gc_list_append(gc, finalizers);
gc->gc.gc_refs = GC_MOVED;
}
! gc = next;
}
}