GNOME Bugzilla – Bug 683088
gdbus-codegen: fix error when wrong interface name is provided to --annotate
Last modified: 2012-09-01 16:01:02 UTC
When a wrong interface name is provided to --annotate, e.g.: --annotate "something.wrong" org.gtk.GDBus.C.ForceGVariant True gdbus-codegen crashes with: Traceback (most recent call last):
+ Trace 230767
sys.exit(codegen_main.codegen_main())
apply_annotations(all_ifaces, opts.annotate)
apply_annotation(iface_list, iface, None, None, None, None, key, value)
if iface_obj == None: UnboundLocalError: local variable 'iface_obj' referenced before assignment
Created attachment 223031 [details] [review] Patch for the issue Just initialize the iface_obj variable before the loop. Now the error is the expected one: Traceback (most recent call last):
+ Trace 230768
raise RuntimeError('No interface %s'%iface)
The following fix has been pushed: 724c8a1 gdbus-codegen: avoid error when wrong interface is provided to --annotate
Created attachment 223149 [details] [review] gdbus-codegen: avoid error when wrong interface is provided to --annotate If the interface given cannot be matched, `iface_obj' was left uninitialized and the iface_obj == None check would end up crashing: Traceback (most recent call last):
+ Trace 230778
if iface_obj == None:
Fixes