diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2012-06-18 19:10:50 +0200 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2012-06-18 23:07:50 +0200 |
commit | 64f3832893080f8faf476fdf730c51a52beb5dfa (patch) | |
tree | db7cdbb992bfc63b222a813d5020bd488be5d684 /giscanner/utils.py | |
parent | 981f0111c39725cf9b25c50d5b130b14f47dd8dd (diff) | |
download | gobject-introspection-64f3832893080f8faf476fdf730c51a52beb5dfa.tar.gz |
scanner: complete the enum-to-error-quark fix
Turns out that the problem was not only in the wrong matching
to GType enums, but also that the non-GType heuristics used
to_underscores instead of to_underscores_noprefix, turning DBusError
into D_Bus_Error instead of DBus_Error.
Complete with various tests.
https://bugzilla.gnome.org/show_bug.cgi?id=669350
Diffstat (limited to 'giscanner/utils.py')
-rw-r--r-- | giscanner/utils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/giscanner/utils.py b/giscanner/utils.py index 2263b8cd..642da362 100644 --- a/giscanner/utils.py +++ b/giscanner/utils.py @@ -52,7 +52,10 @@ _upperstr_pat3 = re.compile(r'^([A-Z])([A-Z])') def to_underscores(name): """Converts a typename to the equivalent underscores name. This is used to form the type conversion macros and enum/flag - name variables""" + name variables. + In particular, and differently from to_underscores_noprefix(), + this function treats the first character differently if it is + uppercase and followed by another uppercase letter.""" name = _upperstr_pat1.sub(r'\1_\2', name) name = _upperstr_pat2.sub(r'\1_\2', name) name = _upperstr_pat3.sub(r'\1_\2', name, count=1) |