[gstreamer-bugs] [Bug 393458] pygobject.gobject_set_property does not handle enum values (well)

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Sat Jan 6 16:15:53 PST 2007


Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=393458

  GStreamer | gst-python | Ver: 0.10.6





------- Comment #4 from René Stadler  2007-01-07 00:14 UTC -------
Why is passing the string "4" as a value to an int/enum property expected to
work?  I do not expect it to work at all, it makes no sense to accept it.  The
object you pass is only supposed to yield a well-defined value through the
number protocol (which does _not_ include the equivalent of performing
int("4"), which is an entirely different thing).  For enum properties, strings
are accepted additionally: The values' nicknames.  This alone is a very good
reason why you cannot accept "4" as 4: There could be a value with the nickname
"4"!  There even is at least one element in GStreamer that has such values,
IIRC it is a compression setting somewhere and goes like:

 nick     value
 --------------
 "best"    0
 "8"       1
 "7"       2
 ...      ...
 "2"       8
 "1"       9 
 "worst"  10

One can see how automagical conversion is not possible.  Even if such a
possibility for collision didn't exist, conversion from string to integer would
be the wrong thing to do.  pygobject simply is not Tcl/Tk :-)

I totally agree that the function is broken and should not be kept around in
this form.  If my assumption is right (it compensated for binding deficiencies
of the time), it can probably just call some_object.set_property directly.


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email




More information about the Gstreamer-bugs mailing list