diff options
Diffstat (limited to 'gi')
-rw-r--r-- | gi/module.py | 8 | ||||
-rw-r--r-- | gi/overrides/Gtk.py | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/gi/module.py b/gi/module.py index 70df76c7..d56bdafe 100644 --- a/gi/module.py +++ b/gi/module.py @@ -24,7 +24,11 @@ from __future__ import absolute_import import os import gobject -import string +try: + maketrans = ''.maketrans +except AttributeError: + # fallback for Python 2 + from string import maketrans import gi from .overrides import registry @@ -124,7 +128,7 @@ class IntrospectionModule(object): # 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( + ascii_upper_trans = maketrans( 'abcdefgjhijklmnopqrstuvwxyz', 'ABCDEFGJHIJKLMNOPQRSTUVWXYZ') for value_info in info.get_values(): diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py index 5e086474..9c35b068 100644 --- a/gi/overrides/Gtk.py +++ b/gi/overrides/Gtk.py @@ -639,12 +639,18 @@ class TextIter(Gtk.TextIter): def forward_search(self, string, flags, limit): success, match_start, match_end = super(TextIter, self).forward_search(string, flags, limit) - return (match_start, match_end,) + if success: + return (match_start, match_end) + else: + return None def backward_search(self, string, flags, limit): success, match_start, match_end = super(TextIter, self).backward_search(string, flags, limit) - return (match_start, match_end,) + if success: + return (match_start, match_end) + else: + return None def begins_tag(self, tag=None): return super(TextIter, self).begins_tag(tag) |