[Python-checkins] CVS: python/dist/src/Include object.h,2.80,2.81

Martin v. L?wis loewis@users.sourceforge.net
Sun, 05 Aug 2001 14:23:05 -0700


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

Modified Files:
	object.h 
Log Message:
Patch #448194: Debuging negative reference counts.


Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.80
retrieving revision 2.81
diff -C2 -d -r2.80 -r2.81
*** object.h	2001/08/02 04:15:00	2.80
--- object.h	2001/08/05 21:23:03	2.81
***************
*** 490,498 ****
  
  #define Py_INCREF(op) (_Py_RefTotal++, (op)->ob_refcnt++)
! #define Py_DECREF(op) \
! 	if (--_Py_RefTotal, (--((op)->ob_refcnt) != 0)) \
! 		; \
! 	else \
! 		_Py_Dealloc((PyObject *)(op))
  #else /* !Py_REF_DEBUG */
  
--- 490,499 ----
  
  #define Py_INCREF(op) (_Py_RefTotal++, (op)->ob_refcnt++)
!   /* under Py_REF_DEBUG: also log negative ref counts after Py_DECREF() !! */
! #define Py_DECREF(op)							\
!        if (--_Py_RefTotal, 0 < (--((op)->ob_refcnt))) ;			\
!        else if (0 == (op)->ob_refcnt) _Py_Dealloc( (PyObject*)(op));	\
!        else (void)fprintf( stderr, "%s:%i negative ref count %i\n",	\
! 		           __FILE__, __LINE__, (op)->ob_refcnt)
  #else /* !Py_REF_DEBUG */