[pygobject] Remove half implemented GC in PyGIBaseInfo, PyGIStruct, and PyGIBoxed
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Remove half implemented GC in PyGIBaseInfo, PyGIStruct, and PyGIBoxed
- Date: Tue, 7 May 2013 22:39:26 +0000 (UTC)
commit a703217eaf4075e9720d4247351e1dfc4f553772
Author: Simon Feltman <sfeltman src gnome org>
Date: Fri Apr 19 06:37:24 2013 -0700
Remove half implemented GC in PyGIBaseInfo, PyGIStruct, and PyGIBoxed
Remove half implemented GC tracking from PyGIBaseInfo as it was not
needed (the implemented was also missing usage of PyObject_GC_New/Track).
Ensure weakref list for PyGIBaseInfo is initialized to NULL and cleared
properly.
Remove invalid calls to PyObject_GC_UnTrack and PyObject_ClearWeakRefs
for both PyGIStruct and PyGIBoxed as these types were not being
advertised as GC aware with Py_TPFLAGS_HAVE_GC.
https://bugzilla.gnome.org/show_bug.cgi?id=677091
gi/pygi-boxed.c | 4 ----
gi/pygi-info.c | 20 +++++---------------
gi/pygi-struct.c | 4 ----
3 files changed, 5 insertions(+), 23 deletions(-)
---
diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c
index cac2b0d..5bf2c19 100644
--- a/gi/pygi-boxed.c
+++ b/gi/pygi-boxed.c
@@ -32,10 +32,6 @@ _boxed_dealloc (PyGIBoxed *self)
{
GType g_type;
- PyObject_GC_UnTrack ( (PyObject *) self);
-
- PyObject_ClearWeakRefs ( (PyObject *) self);
-
if ( ( (PyGBoxed *) self)->free_on_dealloc) {
if (self->slice_allocated) {
g_slice_free1 (self->size, ( (PyGBoxed *) self)->boxed);
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 1229d78..3e8fcb8 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -32,9 +32,8 @@
static void
_base_info_dealloc (PyGIBaseInfo *self)
{
- PyObject_GC_UnTrack ( (PyObject *) self);
-
- PyObject_ClearWeakRefs ( (PyObject *) self);
+ if (self->inst_weakreflist != NULL)
+ PyObject_ClearWeakRefs ( (PyObject *) self);
g_base_info_unref (self->info);
@@ -43,14 +42,6 @@ _base_info_dealloc (PyGIBaseInfo *self)
Py_TYPE( (PyObject *) self)->tp_free ( (PyObject *) self);
}
-static int
-_base_info_traverse (PyGIBaseInfo *self,
- visitproc visit,
- void *arg)
-{
- return 0;
-}
-
static PyObject *
_base_info_repr (PyGIBaseInfo *self)
{
@@ -256,6 +247,8 @@ _pygi_info_new (GIBaseInfo *info)
}
self->info = g_base_info_ref (info);
+ self->inst_weakreflist = NULL;
+ self->cache = NULL;
return (PyObject *) self;
}
@@ -1746,10 +1739,7 @@ _pygi_info_register_types (PyObject *m)
PyGIBaseInfo_Type.tp_dealloc = (destructor) _base_info_dealloc;
PyGIBaseInfo_Type.tp_repr = (reprfunc) _base_info_repr;
- PyGIBaseInfo_Type.tp_flags = (Py_TPFLAGS_DEFAULT |
- Py_TPFLAGS_BASETYPE |
- Py_TPFLAGS_HAVE_GC);
- PyGIBaseInfo_Type.tp_traverse = (traverseproc) _base_info_traverse;
+ PyGIBaseInfo_Type.tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE);
PyGIBaseInfo_Type.tp_weaklistoffset = offsetof(PyGIBaseInfo, inst_weakreflist);
PyGIBaseInfo_Type.tp_methods = _PyGIBaseInfo_methods;
PyGIBaseInfo_Type.tp_richcompare = (richcmpfunc)_base_info_richcompare;
diff --git a/gi/pygi-struct.c b/gi/pygi-struct.c
index eace77c..29ea38e 100644
--- a/gi/pygi-struct.c
+++ b/gi/pygi-struct.c
@@ -34,10 +34,6 @@ _struct_dealloc (PyGIStruct *self)
(PyObject *) self,
&PyGIStructInfo_Type);
- PyObject_GC_UnTrack ( (PyObject *) self);
-
- PyObject_ClearWeakRefs ( (PyObject *) self);
-
if (info != NULL && g_struct_info_is_foreign ( (GIStructInfo *) info)) {
pygi_struct_foreign_release (info, ( (PyGPointer *) self)->pointer);
} else if (self->free_on_dealloc) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]