glib-mkenums breaks if option specified but no nick
@alexl
Submitted by Alexander Larsson Link to original bug (#795008)
Description
gegl has an enum like this:
typedef enum {
GEGL_SAMPLER_NEAREST = 0, /< desc="nearest" >
/
GEGL_SAMPLER_LINEAR, /< desc="linear" >
/
GEGL_SAMPLER_CUBIC, /< desc="cubic" >
/
GEGL_SAMPLER_LOHALO /< desc="lohalo" >
/
} GeglSamplerType;
I.e. it has an options field, but it doesn't specify the nick. The new glib-mkenums crashes on this with:
Traceback (most recent call last):
File "/usr/bin/glib-mkenums", line 709, in <module>
process_file(fname)
File "/usr/bin/glib-mkenums", line 505, in process_file
parse_entries(curfile, curfilename)
File "/usr/bin/glib-mkenums", line 221, in parse_entries
entries.append((name, value, options['nick']))
KeyError: 'nick'
Because apparently this code:
if options is not None:
options = parse_trigraph(options)
if 'skip' not in options:
entries.append((name, value, options['nick']))
Does not handle skip not being set, and nick being unset.
This should probably be options.get('nick', None) or something.