[Python-checkins] CVS: python/dist/src/Modules _weakref.c,1.12,1.13

Neil Schemenauer nascheme@users.sourceforge.net
Wed, 29 Aug 2001 16:50:04 -0700


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

Modified Files:
	_weakref.c 
Log Message:
Use new GC API.


Index: _weakref.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_weakref.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** _weakref.c	2001/08/16 14:11:30	1.12
--- _weakref.c	2001/08/29 23:50:02	1.13
***************
*** 39,43 ****
      }
      else {
!         result = PyObject_NEW(PyWeakReference, &PyWeakReference_Type);
      }
      if (result)
--- 39,43 ----
      }
      else {
!         result = PyObject_GC_New(PyWeakReference, &PyWeakReference_Type);
      }
      if (result)
***************
*** 78,83 ****
  weakref_dealloc(PyWeakReference *self)
  {
      clear_weakref(self);
-     PyObject_GC_Fini((PyObject *)self);
      self->wr_next = free_list;
      free_list = self;
--- 78,83 ----
  weakref_dealloc(PyWeakReference *self)
  {
+     PyObject_GC_UnTrack((PyObject *)self);
      clear_weakref(self);
      self->wr_next = free_list;
      free_list = self;
***************
*** 171,175 ****
      0,
      "weakref",
!     sizeof(PyWeakReference) + PyGC_HEAD_SIZE,
      0,
      (destructor)weakref_dealloc,/*tp_dealloc*/
--- 171,175 ----
      0,
      "weakref",
!     sizeof(PyWeakReference),
      0,
      (destructor)weakref_dealloc,/*tp_dealloc*/
***************
*** 188,192 ****
      0,                          /*tp_setattro*/
      0,                          /*tp_as_buffer*/
!     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC | Py_TPFLAGS_HAVE_RICHCOMPARE,
      0,                          /*tp_doc*/
      (traverseproc)gc_traverse,  /*tp_traverse*/
--- 188,192 ----
      0,                          /*tp_setattro*/
      0,                          /*tp_as_buffer*/
!     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_RICHCOMPARE,
      0,                          /*tp_doc*/
      (traverseproc)gc_traverse,  /*tp_traverse*/
***************
*** 430,434 ****
      0,
      "weakproxy",
!     sizeof(PyWeakReference) + PyGC_HEAD_SIZE,
      0,
      /* methods */
--- 430,434 ----
      0,
      "weakproxy",
!     sizeof(PyWeakReference),
      0,
      /* methods */
***************
*** 448,452 ****
      (setattrofunc)proxy_setattr,/*tp_setattro*/
      0,				/*tp_as_buffer*/
!     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC
      |Py_TPFLAGS_CHECKTYPES,     /*tp_flags*/
      0,                          /*tp_doc*/
--- 448,452 ----
      (setattrofunc)proxy_setattr,/*tp_setattro*/
      0,				/*tp_as_buffer*/
!     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
      |Py_TPFLAGS_CHECKTYPES,     /*tp_flags*/
      0,                          /*tp_doc*/
***************
*** 461,465 ****
      0,
      "weakcallableproxy",
!     sizeof(PyWeakReference) + PyGC_HEAD_SIZE,
      0,
      /* methods */
--- 461,465 ----
      0,
      "weakcallableproxy",
!     sizeof(PyWeakReference),
      0,
      /* methods */
***************
*** 479,483 ****
      (setattrofunc)proxy_setattr,/*tp_setattro*/
      0,				/*tp_as_buffer*/
!     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC
      |Py_TPFLAGS_CHECKTYPES,     /*tp_flags*/
      0,                          /*tp_doc*/
--- 479,483 ----
      (setattrofunc)proxy_setattr,/*tp_setattro*/
      0,				/*tp_as_buffer*/
!     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
      |Py_TPFLAGS_CHECKTYPES,     /*tp_flags*/
      0,                          /*tp_doc*/
***************
*** 649,653 ****
                          insert_after(result, prev);
                  }
!                 PyObject_GC_Init((PyObject *) result);
              }
          }
--- 649,653 ----
                          insert_after(result, prev);
                  }
!                 PyObject_GC_Track(result);
              }
          }
***************
*** 707,711 ****
                  else
                      insert_after(result, prev);
!                 PyObject_GC_Init((PyObject *) result);
              }
          }
--- 707,711 ----
                  else
                      insert_after(result, prev);
!                 PyObject_GC_Track(result);
              }
          }