import gtk
import gc

class DelNotify(object):
    def __del__(self): print '__del__'


class MyButton(gtk.Button):
    def __init__(self, message):
        self._attr = DelNotify()
        self._message = message
        gtk.Button.__init__(self, 'Push to Generate Error')
        self.connect('clicked', self._on_clicked)

    def _on_clicked(self, widget):
        print self._message


def quit(w):
    gtk.main_quit()

def create():
    w = gtk.Window()
    w.add(MyButton('Hello World'))
    w.connect('destroy', quit)
    w.show_all()

gc.set_debug(gc.DEBUG_COLLECTABLE
             |gc.DEBUG_UNCOLLECTABLE
             |gc.DEBUG_OBJECTS)
create()
gc.collect()
gtk.main()
