GNOME Bugzilla – Bug 544946
backward compatibility break caused by function semantics change in new 'glib' module
Last modified: 2008-09-18 09:40:42 UTC
What were you doing when the application crashed? Distribution: Gentoo Base System release 2.0.0 Gnome Release: 2.23.5 2008-07-26 (Gentoo) BugBuddy Version: 2.23.5.1 System: Linux 2.6.22-gentoo-r9 #1 Sat Nov 24 20:00:11 CET 2007 i686 X Vendor: The X.Org Foundation X Vendor Release: 10300000 Selinux: No Accessibility: Enabled GTK+ Theme: nimbus Icon Theme: nimbus Memory status: size: 0 vsize: 0 resident: 0 share: 0 rss: 0 rss_rlim: 0 CPU usage: start_time: 0 rtime: 0 utime: 0 stime: 0 cutime:0 cstime: 0 timeout: 0 it_real_value: 0 frequency: 0 ----------- .xsession-errors (25 sec old) --------------------- ** (gnome-session:10215): DEBUG: IceProcessMessagesIOError on '0x8088950 [gnome-session-splash 107ddb557271b6f534121714992985066200000102150008]' ** (gnome-session:10215): DEBUG: xsmp_finalize (0x8088950 [gnome-session-splash 107ddb557271b6f534121714992985066200000102150008]) ** (gnome-session:10215): DEBUG: Set properties from client '0x80889b0 [nautilus 107ddb557271b6f534121714992981824200000102150003]' ** (gnome-session:10215): DEBUG: _GSM_Priority = 40 ** (gnome-session:10215): DEBUG: Set properties from client '0x80889b0 [nautilus 107ddb557271b6f534121714992981824200000102150003]' ** (gnome-session:10215): DEBUG: RestartStyleHint = 0 ** (nautilus:10289): WARNING **: Unable to add monitor: Nicht unterstützt ** (gnome-session:10215): DEBUG: Set properties from client '0x80889b0 [nautilus 107ddb557271b6f534121714992981824200000102150003]' ** (gnome-session:10215): DEBUG: _GSM_Priority = 40 ** (gnome-session:10215): DEBUG: Set properties from client '0x80889b0 [nautilus 107ddb557271b6f534121714992981824200000102150003]' ** (gnome-session:10215): DEBUG: RestartStyleHint = 2 ** (gnome-panel:10281): WARNING **: panel-applet-frame.c:1270: failed to load applet OAFIID:Deskbar_Applet: System exception: IDL:Bonobo/GeneralError:1.0 : Kindprozess gab keine Fehlermeldung aus. Ein unbekannter Störfall trat auf -------------------------------------------------- Traceback (most recent call last):
+ Trace 203901
gtk.gdk.threads_init()
*** Bug 545223 has been marked as a duplicate of this bug. ***
The error appeared in gtk. Reassigning to pygtk team.
This is not a bug in gtk.gdk.threads_init, since it just does: Py_INCREF(Py_None); return Py_None; The bug must be else where in the stack. Reassigning back to Deskbar, please don't move over bugs to pygobject/pygtk without a test case.
*** Bug 545923 has been marked as a duplicate of this bug. ***
Still, the only thing I do is call gtk.gdk.threads_init(). What could I do wrong by that? In addition, it works with pygtk 2.12
Reassigning back to PyGTK. _Even_ if something is done wrong, threads_init() must not fail with this absolutely unhelpful exception. Test: >>> import gobject, gtk >>> gobject.threads_init() >>> gtk.gdk.threads_init() Traceback (most recent call last):
+ Trace 204488
This is with recent SVN PyGObject and PyGTK.
Created attachment 115776 [details] [review] probable fix The cause is that pyglib_enable_threads() returns gboolean with FALSE meaning failure. Before, pyg_enable_threads() used to return an int with Python meaning: i.e. 0 means success, -1 failure. So, this is compatibility break. Patch reverts this. We must investigate all functions in new 'glib' module if they behave in backwards-compatible way.
It seems that other functions are fine. gboolean pyglib_gerror_exception_check(GError **error) is weird in that it returns an integer (not a boolean value), but at least it is the same as it was in older PyGObject versions.
Yeah this makes totally sense, Paul I think you can just commit this one, Jdahlin will review anyway and if it's not good reopen the bug.
Committing the patch then. I also noticed I forget to change one FALSE to -1, done when committing. Sending ChangeLog Sending glib/pyglib.c Sending glib/pyglib.h Sending gobject/gobjectmodule.c Transmitting file data .... Committed revision 922.
(In reply to comment #7) > Created an attachment (id=115776) [edit] > probable fix > > The cause is that pyglib_enable_threads() returns gboolean with FALSE meaning > failure. Before, pyg_enable_threads() used to return an int with Python > meaning: i.e. 0 means success, -1 failure. So, this is compatibility break. > Patch reverts this. > > We must investigate all functions in new 'glib' module if they behave in > backwards-compatible way. > No, only the ones which are exported directly in the PyGObject API struct. Since pyglib_* is not required to keep the compatibility with pyg_* we're allowed to change the name, meaning and return values etc. 0 and -1 is kind of weird for a function returning a 'boolean' result, shouldn't we just fix that and add a smaller wrapper in PyGObject which converts it to the old, expected values?
Well, it in fact returns an 'int' (now and used to before 'glib' module). I'd propose to keep the rule that as long as it returns 'gboolean', FALSE means error, but if it returns 'int', then it is a Python-standard code with -1 meaning error. As long as pyg_enable_threads() remains backward-compatible, it is all fine to me. E.g. you can, as you propose, have a wrapper translating result between pyglib_enable_threads() and pyg_enable_threads(). But in this case let's make it 'gboolean pyglib_...' and 'int pyg_...', hinting at return value semantics. More disturbing is pyglib_gerror_exception_check() which claims to return 'gboolean', but return values are 0, -1 or -2...
(In reply to comment #12) > Well, it in fact returns an 'int' (now and used to before 'glib' module). I'd > propose to keep the rule that as long as it returns 'gboolean', FALSE means > error, but if it returns 'int', then it is a Python-standard code with -1 > meaning error. > > As long as pyg_enable_threads() remains backward-compatible, it is all fine to > me. E.g. you can, as you propose, have a wrapper translating result between > pyglib_enable_threads() and pyg_enable_threads(). But in this case let's make > it > 'gboolean pyglib_...' and 'int pyg_...', hinting at return value semantics. > More disturbing is pyglib_gerror_exception_check() which claims to return > 'gboolean', but return values are 0, -1 or -2... Okay that is a mistake, let's fix that. Reopening.
*** Bug 546149 has been marked as a duplicate of this bug. ***
Maybe better to let this one closed and open a new bug if you want. This bug is fixed in the sense it doesn't crash anymore. Remaining part is 'enchancement', not 'blocker'.
2008-08-06 Johan Dahlin <johan@gnome.org> * glib/pyglib.c (pyglib_enable_threads): * gobject/gobjectmodule.c (pyg_threads_init), (pygobject_enable_threads): Add a pygobject_enable_threads wrapper around pyglib_threads_enable and return 0/-1 which existing gobject based applications expect.
*** Bug 548187 has been marked as a duplicate of this bug. ***
*** Bug 550292 has been marked as a duplicate of this bug. ***
*** Bug 550293 has been marked as a duplicate of this bug. ***
*** Bug 550300 has been marked as a duplicate of this bug. ***
*** Bug 550308 has been marked as a duplicate of this bug. ***
*** Bug 550309 has been marked as a duplicate of this bug. ***
*** Bug 550310 has been marked as a duplicate of this bug. ***
*** Bug 550311 has been marked as a duplicate of this bug. ***
*** Bug 550312 has been marked as a duplicate of this bug. ***
*** Bug 550314 has been marked as a duplicate of this bug. ***
*** Bug 550315 has been marked as a duplicate of this bug. ***
*** Bug 550318 has been marked as a duplicate of this bug. ***
*** Bug 550319 has been marked as a duplicate of this bug. ***
*** Bug 550320 has been marked as a duplicate of this bug. ***
*** Bug 550321 has been marked as a duplicate of this bug. ***
*** Bug 550323 has been marked as a duplicate of this bug. ***
*** Bug 550324 has been marked as a duplicate of this bug. ***
*** Bug 550325 has been marked as a duplicate of this bug. ***
*** Bug 550326 has been marked as a duplicate of this bug. ***
*** Bug 550331 has been marked as a duplicate of this bug. ***
*** Bug 550332 has been marked as a duplicate of this bug. ***
*** Bug 550336 has been marked as a duplicate of this bug. ***
*** Bug 550337 has been marked as a duplicate of this bug. ***
*** Bug 550338 has been marked as a duplicate of this bug. ***
*** Bug 550339 has been marked as a duplicate of this bug. ***
*** Bug 550340 has been marked as a duplicate of this bug. ***
*** Bug 550341 has been marked as a duplicate of this bug. ***
*** Bug 550347 has been marked as a duplicate of this bug. ***
*** Bug 550348 has been marked as a duplicate of this bug. ***
*** Bug 550349 has been marked as a duplicate of this bug. ***
*** Bug 550350 has been marked as a duplicate of this bug. ***
*** Bug 550351 has been marked as a duplicate of this bug. ***
*** Bug 550355 has been marked as a duplicate of this bug. ***
*** Bug 550356 has been marked as a duplicate of this bug. ***
*** Bug 550357 has been marked as a duplicate of this bug. ***
*** Bug 550359 has been marked as a duplicate of this bug. ***
*** Bug 550360 has been marked as a duplicate of this bug. ***
*** Bug 550362 has been marked as a duplicate of this bug. ***
*** Bug 550363 has been marked as a duplicate of this bug. ***
*** Bug 550365 has been marked as a duplicate of this bug. ***
*** Bug 550367 has been marked as a duplicate of this bug. ***
*** Bug 550368 has been marked as a duplicate of this bug. ***
*** Bug 550369 has been marked as a duplicate of this bug. ***
*** Bug 550370 has been marked as a duplicate of this bug. ***
*** Bug 550371 has been marked as a duplicate of this bug. ***
*** Bug 550372 has been marked as a duplicate of this bug. ***
*** Bug 550376 has been marked as a duplicate of this bug. ***
*** Bug 550377 has been marked as a duplicate of this bug. ***
*** Bug 550378 has been marked as a duplicate of this bug. ***
*** Bug 550379 has been marked as a duplicate of this bug. ***
*** Bug 550380 has been marked as a duplicate of this bug. ***
*** Bug 550383 has been marked as a duplicate of this bug. ***
*** Bug 550384 has been marked as a duplicate of this bug. ***
*** Bug 550386 has been marked as a duplicate of this bug. ***
*** Bug 550387 has been marked as a duplicate of this bug. ***
*** Bug 550388 has been marked as a duplicate of this bug. ***
*** Bug 550389 has been marked as a duplicate of this bug. ***
*** Bug 550390 has been marked as a duplicate of this bug. ***
*** Bug 550392 has been marked as a duplicate of this bug. ***
*** Bug 550393 has been marked as a duplicate of this bug. ***
*** Bug 550394 has been marked as a duplicate of this bug. ***
*** Bug 550395 has been marked as a duplicate of this bug. ***
*** Bug 550405 has been marked as a duplicate of this bug. ***
*** Bug 550406 has been marked as a duplicate of this bug. ***
*** Bug 550407 has been marked as a duplicate of this bug. ***
*** Bug 550408 has been marked as a duplicate of this bug. ***
*** Bug 550409 has been marked as a duplicate of this bug. ***
*** Bug 550411 has been marked as a duplicate of this bug. ***
*** Bug 550423 has been marked as a duplicate of this bug. ***
*** Bug 550425 has been marked as a duplicate of this bug. ***
*** Bug 550426 has been marked as a duplicate of this bug. ***
*** Bug 550427 has been marked as a duplicate of this bug. ***
*** Bug 550429 has been marked as a duplicate of this bug. ***
*** Bug 550431 has been marked as a duplicate of this bug. ***
*** Bug 550432 has been marked as a duplicate of this bug. ***
*** Bug 550436 has been marked as a duplicate of this bug. ***
*** Bug 550437 has been marked as a duplicate of this bug. ***
*** Bug 550438 has been marked as a duplicate of this bug. ***
*** Bug 550439 has been marked as a duplicate of this bug. ***
*** Bug 550440 has been marked as a duplicate of this bug. ***
*** Bug 550444 has been marked as a duplicate of this bug. ***
*** Bug 550450 has been marked as a duplicate of this bug. ***
*** Bug 550451 has been marked as a duplicate of this bug. ***
*** Bug 550452 has been marked as a duplicate of this bug. ***
*** Bug 550453 has been marked as a duplicate of this bug. ***
*** Bug 550457 has been marked as a duplicate of this bug. ***
*** Bug 550459 has been marked as a duplicate of this bug. ***
*** Bug 550460 has been marked as a duplicate of this bug. ***
*** Bug 550465 has been marked as a duplicate of this bug. ***
*** Bug 550480 has been marked as a duplicate of this bug. ***
*** Bug 550487 has been marked as a duplicate of this bug. ***
*** Bug 550505 has been marked as a duplicate of this bug. ***
*** Bug 550506 has been marked as a duplicate of this bug. ***
*** Bug 550507 has been marked as a duplicate of this bug. ***
*** Bug 547976 has been marked as a duplicate of this bug. ***
*** Bug 550517 has been marked as a duplicate of this bug. ***
*** Bug 550518 has been marked as a duplicate of this bug. ***
*** Bug 550522 has been marked as a duplicate of this bug. ***
*** Bug 550554 has been marked as a duplicate of this bug. ***
*** Bug 550534 has been marked as a duplicate of this bug. ***
*** Bug 550515 has been marked as a duplicate of this bug. ***
*** Bug 550511 has been marked as a duplicate of this bug. ***
*** Bug 550531 has been marked as a duplicate of this bug. ***
*** Bug 550544 has been marked as a duplicate of this bug. ***
*** Bug 550562 has been marked as a duplicate of this bug. ***
*** Bug 550565 has been marked as a duplicate of this bug. ***
*** Bug 550572 has been marked as a duplicate of this bug. ***
*** Bug 550574 has been marked as a duplicate of this bug. ***
*** Bug 550579 has been marked as a duplicate of this bug. ***
*** Bug 550580 has been marked as a duplicate of this bug. ***
*** Bug 550581 has been marked as a duplicate of this bug. ***
*** Bug 550599 has been marked as a duplicate of this bug. ***
*** Bug 550649 has been marked as a duplicate of this bug. ***
*** Bug 550629 has been marked as a duplicate of this bug. ***
*** Bug 550618 has been marked as a duplicate of this bug. ***
*** Bug 550602 has been marked as a duplicate of this bug. ***
*** Bug 550603 has been marked as a duplicate of this bug. ***
*** Bug 550688 has been marked as a duplicate of this bug. ***
*** Bug 550698 has been marked as a duplicate of this bug. ***
*** Bug 550705 has been marked as a duplicate of this bug. ***
*** Bug 550738 has been marked as a duplicate of this bug. ***
*** Bug 550748 has been marked as a duplicate of this bug. ***
*** Bug 550808 has been marked as a duplicate of this bug. ***
*** Bug 550814 has been marked as a duplicate of this bug. ***
*** Bug 550956 has been marked as a duplicate of this bug. ***
*** Bug 550955 has been marked as a duplicate of this bug. ***
*** Bug 552369 has been marked as a duplicate of this bug. ***