[Python-checkins] CVS: python/dist/src/Modules gcmodule.c,2.26,2.27

Guido van Rossum gvanrossum@users.sourceforge.net
Thu, 01 Nov 2001 06:23:30 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv5644

Modified Files:
	gcmodule.c 
Log Message:
SF bug #477059 (my own): __del__ on new classes vs. GC.

When moving objects with a __del__ attribute to a special list, look
for __del__ on new-style classes with the HEAPTYPE flag set as well.
(HEAPTYPE means the class was created by a class statement.)


Index: gcmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v
retrieving revision 2.26
retrieving revision 2.27
diff -C2 -d -r2.26 -r2.27
*** gcmodule.c	2001/10/31 23:09:35	2.26
--- gcmodule.c	2001/11/01 14:23:28	2.27
***************
*** 242,246 ****
  		PyObject *op = FROM_GC(gc);
  		next = gc->gc.gc_next;
! 		if (PyInstance_Check(op) && PyObject_HasAttr(op, delstr)) {
  			gc_list_remove(gc);
  			gc_list_append(gc, finalizers);
--- 242,248 ----
  		PyObject *op = FROM_GC(gc);
  		next = gc->gc.gc_next;
! 		if ((PyInstance_Check(op) ||
! 		     PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) &&
! 		    PyObject_HasAttr(op, delstr)) {
  			gc_list_remove(gc);
  			gc_list_append(gc, finalizers);