Gdk.color_parse returns Gdk.Color instead of a tuple after updating python-gobject to 2.90.3-1svn1

Bug #842235 reported by Daniel Manrique
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pygobject (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

I installed Oneiric Beta1, and then updated some packages, among them python-gobject (which pulled a new package, python-gobject-2). After this, System Testing (checkbox-gtk) crashes as described in bug 839675.

As indicated in that bug, the problem is caused by an API-breaking change in PyGTK:

https://bugzilla.gnome.org/show_bug.cgi?id=653462

"
Change Gdk.color_parse() to not return a tuple, instead just
return the created color or None if it wasn't possible to parse
the name into a color.

This keeps compatibility with PyGTK but breaks the current API.

"

So I'm filing this bug to keep track of the fact that the API has changed.

Steps to reproduce:

1- On an Oneiric b1 system check the version of python-gobject, should be 2.28.6-4.
2- Launch a Python shell and execute:
 from gi.repository import Gdk
 Gdk.color_parse("#ffffff")
3- Result should be a tuple, like (True, <Gdk.Color(red=65535, green=65535, blue=65535)>)
4- update python-gobject by running sudo apt-get install python-gobject. This will bring in python-gobject-2 and versions will be:
python-gobject 2.90.3-1svn1
python-gobject-2 2.28.6-6svn1
5- Again, aunch a Python shell and execute:
 from gi.repository import Gdk
 Gdk.color_parse("#ffffff")
6- Result is now just a Gdk.color, like: <Gdk.Color(red=65535, green=65535, blue=65535)>

Revision history for this message
Martin Pitt (pitti) wrote :

This was done by http://git.gnome.org/browse/pygobject/commit/?id=5b1c875269b7979caae97e84919a690a34d92f29

It is indeed an API break compared to the previous pygobject version, but it actually brings back the API that PyGTK has. Unfortunately this was unavoidable, as the old API returning a bool and a color object was unsafe: it caused crashes when the boolean return value was False, as the returned pointer was invalid.

So this needs to be fixed in checkbox, sorry about that. As there is already a bug about that, I'm just closing this one.

Changed in pygobject (Ubuntu):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.