On Fri, 2008-10-17 at 12:36 +0300, Juho Vuori wrote: > ob = x() > del(ob)
It works here (see below), although it prints an error due to GObject.__del__ not being defined. Are you using the latest version of gobject? At some point it used to be the case that gobjects instances participated in a cycle, which meant that: a) they were only ever deallocated by the gc, and b) the ones that defined __del__ were never collected without special provisions, as described in the gc module's documentation. This was changed fairly recently, so you might not have this behavior yet. Note that in Python it's usually best to avoid the use of __del__ altogether. What do you need it for? $ python Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 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) <class '__main__.x'> >>> ob = x() init x >>> del(ob) del x Exception exceptions.AttributeError: "'super' object has no attribute '__del__'" in <bound method x.__del__ of <x object at 0x836589c (__main__+x at 0x821f7b0)>> ignored _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
