GNOME Bugzilla – Bug 638267
gc.collect deletes __dict__ of an object in a GTK-object, Python-object cycle
Last modified: 2017-10-27 19:27:20 UTC
Created attachment 177189 [details] Example that shows the bug. Linux fortuna 2.6.37-11-generic #25-Ubuntu SMP Tue Dec 21 23:42:56 UTC 2010 x86_64 GNU/Linux Python 2.7.1+ python-gobject 2.27.0-0ubuntu5 python-gtk2 2.22.0-0ubuntu1 First we need a class that contains some GTK+ widgets and a signal connected. I'll take this simple class: class SomeWindow(object): def __init__(self): self.button = gtk.Button("Click me") self.button.connect("clicked", self._on_button_clicked) self.window = gtk.Window() self.window.add(self.button) print self.__dict__ def show(self): self.window.show_all() def _on_button_clicked(self, *_): print self.__dict__ When I create and show the window with `SomeWindow().show()' the window is shown correctly but in the _on_button_clicked method __dict__ is {} (after the garbage collector has been invoked). You'll find this example attached in the cycle_bug.py file. There were some bugs like this in the past, especially * http://www.daa.com.au/pipermail/pygtk/2008-August/015770.html and * https://bugzilla.gnome.org/show_bug.cgi?id=92955 is very similar to this one.
Confirming with 3.2.0.
Turns out this had the same cause as bug 731501. Fixed in 3.26.1 *** This bug has been marked as a duplicate of bug 731501 ***