[Python-checkins] python/dist/src/Include objimpl.h,2.54,2.55

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Tue, 02 Jul 2002 11:12:38 -0700


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

Modified Files:
	objimpl.h 
Log Message:
Finished transitioning to using gc_refs to track gc objects' states.
This was mostly a matter of adding comments and light code rearrangement.
Upon untracking, gc_next is still set to NULL.  It's a cheap way to
provoke memory faults if calling code is insane.  It's also used in some
way by the trashcan mechanism.


Index: objimpl.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v
retrieving revision 2.54
retrieving revision 2.55
diff -C2 -d -r2.54 -r2.55
*** objimpl.h	2 Jul 2002 00:52:30 -0000	2.54
--- objimpl.h	2 Jul 2002 18:12:34 -0000	2.55
***************
*** 252,256 ****
  typedef union _gc_head {
  	struct {
! 		union _gc_head *gc_next; /* not NULL if object is tracked */
  		union _gc_head *gc_prev;
  		int gc_refs;
--- 252,256 ----
  typedef union _gc_head {
  	struct {
! 		union _gc_head *gc_next;
  		union _gc_head *gc_prev;
  		int gc_refs;
***************
*** 273,277 ****
  	if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \
  		Py_FatalError("GC object already tracked"); \
- 	assert(g->gc.gc_refs == _PyGC_REFS_UNTRACKED); \
  	g->gc.gc_refs = _PyGC_REFS_REACHABLE; \
  	g->gc.gc_next = _PyGC_generation0; \
--- 273,276 ----
***************
*** 281,285 ****
      } while (0);
  
! /* Tell the GC to stop tracking this object. */
  #define _PyObject_GC_UNTRACK(o) do { \
  	PyGC_Head *g = _Py_AS_GC(o); \
--- 280,287 ----
      } while (0);
  
! /* Tell the GC to stop tracking this object.
!  * gc_next doesn't need to be set to NULL, but doing so is a good
!  * way to provoke memory errors if calling code is confused.
!  */
  #define _PyObject_GC_UNTRACK(o) do { \
  	PyGC_Head *g = _Py_AS_GC(o); \