GNOME Bugzilla – Bug 578419
Segfault with 2.16.1 version and pyg_type_add_interfaces
Last modified: 2009-04-10 14:17:21 UTC
Hi, I notice there is some segfault with the pygobject 2.16, using 2 different python projects : Screenlets on Debian unstable : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=519664 Gramps on Ubuntu Jaunty : https://bugs.launchpad.net/ubuntu/+source/pygobject/+bug/357740 Backtraces are included in this 2 reports, this is the one for Screenlets : $ gdb python GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu"... (gdb) run /usr/share/screenlets/AppMenu/AppMenuScreenlet.py Starting program: /usr/bin/python /usr/share/screenlets/AppMenu/AppMenuScreenlet.py [Thread debugging using libthread_db enabled] [New Thread 0x7f620ca6f6f0 (LWP 20177)] Program received signal SIGSEGV, Segmentation fault.
+ Trace 214301
Thread 140059095791344 (LWP 20177)
My first thought is that there is a problem in pyg_type_add_interfaces, because the problem appear after the upgrade to 2.16.1 and because it's a new function introduced in 2.16. The problem is not reproductible on all configuration, I was unable to reproduce it on Debian unstable.
I cannot reliably reproduce this except when running in valgrind. The following code triggers it in valgrind: ---------- import gtk class ManagedWindow: pass class Assistant(gtk.Object, ManagedWindow): __gproperties__ = {} ---------- I think it must be a side effect of old-style classes. Changing -class ManagedWindow: +class ManagedWindow(object): Makes the problem go away. I know, it's no excuse, but I am just saying, multiple inheritance plus old-style classes is just asking for trouble :)
As far as I can tell this is a Python/C bug. PyGObject is doing everything by the book, and it is Python that is giving us corrupted base objects. I debugged long and hard but was unable to fix a bug that just isn't there, nor was I able to figure out a workaround. I suggest applications start using new-style classes for everything. Old-style classes will disappear anyway in Python 3.x.