[pygtk] Deleting objects inherited from gobject.

Juho Vuori juho.vuori at fimr.fi
Fri Oct 17 17:36:18 WST 2008


Hello,

The following code prints only 'init x'. Never 'del x'. What is
happening? How can one actually delete an object that inherits from
gobject? The code works ok, if you change the parent class of x to just
object or something else. Calling sys.getrefcount(ob) just before the
del-statement returns 3.

Juho Vuori



import gobject

class x(gobject.GObject):
    def __init__(self):
        super(x,self).__init__()
        print 'init x'

    def __del__(self):
        print 'del x'
        super(x,self).__del__()

gobject.type_register(x)
ob = x()
del(ob)




More information about the pygtk mailing list