[Python-checkins] python/dist/src/Modules gcmodule.c,2.54,2.55

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 09 Aug 2002 10:39:17 -0700


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

Modified Files:
	gcmodule.c 
Log Message:
For new-style classes, we can now test for tp_del instead of asking
for a __del__ attribute, to see if there's a finalizer.


Index: gcmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v
retrieving revision 2.54
retrieving revision 2.55
diff -C2 -d -r2.54 -r2.55
*** gcmodule.c	7 Jul 2002 05:13:56 -0000	2.54
--- gcmodule.c	9 Aug 2002 17:39:14 -0000	2.55
***************
*** 347,353 ****
  			Py_FatalError("PyGC: can't initialize __del__ string");
  	}
! 	return (PyInstance_Check(op) ||
! 	        PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE))
! 	       && PyObject_HasAttr(op, delstr);
  }
  
--- 347,353 ----
  			Py_FatalError("PyGC: can't initialize __del__ string");
  	}
! 	return PyInstance_Check(op) ? PyObject_HasAttr(op, delstr) :
! 	        PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE) ?
! 		op->ob_type->tp_del != NULL : 0;
  }