summaryrefslogtreecommitdiff
path: root/pygtkcompat
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-11-29 16:45:49 +0100
committerMartin Pitt <martinpitt@gnome.org>2012-11-29 16:45:49 +0100
commitd47283936b4c0b5e8b6ede8886c4badbf6d6e694 (patch)
tree615bddf9668dfd9bae297da3da5652bfe06e49f7 /pygtkcompat
parent3fa31b1a7936c556e76bd8a42030567c6a867e0d (diff)
downloadpygobject-d47283936b4c0b5e8b6ede8886c4badbf6d6e694.tar.gz
pygtkcompat: Work around IndexError on large flags
On 32 bit systems pygtkcompat currently fails with File "pygtkcompat/pygtkcompat.py", line 74, in _install_enums name = flag.value_names[-1].replace(modname + '_', '') IndexError: cannot fit 'int' into an index-sized integer on 32 bit systems as some flags in Gdk are too large to fit into a 32 bit "long". Work around this crash until this gets fixed properly (marked as FIXME).
Diffstat (limited to 'pygtkcompat')
-rw-r--r--pygtkcompat/pygtkcompat.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/pygtkcompat/pygtkcompat.py b/pygtkcompat/pygtkcompat.py
index 7b37599b..18ebd7b9 100644
--- a/pygtkcompat/pygtkcompat.py
+++ b/pygtkcompat/pygtkcompat.py
@@ -71,7 +71,12 @@ def _install_enums(module, dest=None, strip=''):
try:
if issubclass(obj, GObject.GFlags):
for value, flag in obj.__flags_values__.items():
- name = flag.value_names[-1].replace(modname + '_', '')
+ try:
+ name = flag.value_names[-1].replace(modname + '_', '')
+ except IndexError:
+ # FIXME: this happens for some large flags which do not
+ # fit into a long on 32 bit systems
+ continue
setattr(dest, name, flag)
except TypeError:
continue