diff options
Diffstat (limited to 'gi/module.py')
-rw-r--r-- | gi/module.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gi/module.py b/gi/module.py index 3e2b59e..70df76c 100644 --- a/gi/module.py +++ b/gi/module.py @@ -24,6 +24,7 @@ from __future__ import absolute_import import os import gobject +import string import gi from .overrides import registry @@ -120,8 +121,14 @@ class IntrospectionModule(object): wrapper.__info__ = info wrapper.__module__ = 'gi.repository.' + info.get_namespace() + # Don't use upper() here to avoid locale specific + # identifier conversion (e. g. in Turkish 'i'.upper() == 'i') + # see https://bugzilla.gnome.org/show_bug.cgi?id=649165 + ascii_upper_trans = string.maketrans( + 'abcdefgjhijklmnopqrstuvwxyz', + 'ABCDEFGJHIJKLMNOPQRSTUVWXYZ') for value_info in info.get_values(): - value_name = value_info.get_name().upper() + value_name = value_info.get_name().translate(ascii_upper_trans) setattr(wrapper, value_name, wrapper(value_info.get_value())) if g_type != gobject.TYPE_NONE: @@ -150,7 +157,9 @@ class IntrospectionModule(object): elif isinstance(info, (StructInfo, UnionInfo)): if g_type.is_a(gobject.TYPE_BOXED): bases = (Boxed,) - elif g_type.is_a(gobject.TYPE_POINTER) or g_type == gobject.TYPE_NONE: + elif g_type.is_a(gobject.TYPE_POINTER) or \ + g_type == gobject.TYPE_NONE or \ + g_type.fundamental == g_type: bases = (Struct,) else: raise TypeError("unable to create a wrapper for %s.%s" % (info.get_namespace(), info.get_name())) |