[pygobject/pygobject-3-4] pygtkcompat: Work around IndexError on large flags
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-3-4] pygtkcompat: Work around IndexError on large flags
- Date: Fri, 30 Nov 2012 07:58:08 +0000 (UTC)
commit 1ce98d453b451b89b8bd0154ed1059c4939263e3
Author: Martin Pitt <martinpitt gnome org>
Date: Thu Nov 29 16:45:49 2012 +0100
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).
gi/pygtkcompat.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gi/pygtkcompat.py b/gi/pygtkcompat.py
index 2c81d3f..7d09f0a 100644
--- a/gi/pygtkcompat.py
+++ b/gi/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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]