I have been fighting with this error for a while and I ended up thinking that it might be a bug on GTK+'s Python bindings side, because this code worked with PyGTK (version 2).
I simplified my application to the following excerpt. It just creates a buffer with some assembler code, gets an iterator (it happens to go to the end after the get_iter_at_location() call) and tries to go backwards looking for a character in
[' ', ',', '\t', '\n', '(', ')']
Right when I call backward_find_char(), Python yells with an error:
** (XXXX.py:22748): WARNING **: Unhandled type tag gunichar
once per character, and passes nothing to the GtkTextCharPredicate function is_word_sep(). I suspect now that it's a missing header/whatever in the Python definition of the class (https://developer.gnome.org/gtk3/stable/GtkTextIter.html#GtkTextCharPredicate, where I can see the gunichar as the first argument), but I'm not sure yet.
This is happening on a Debian testing with gir1.2-gtksource-3.0 3.18.1-1
import gi
gi.require_version('GtkSource', '3.0')
from gi.repository import GtkSource
def is_word_sep(x, bogus):
print('is_word_sep called with %s, %s' % (x, bogus))
word_separators = [' ', ',', '\t', '\n', '(', ')']
return x in word_separators
text = '''
; [11] va=0x00400450 pa=0x00000450 sz=80 vsz=80 rwx=-r-x .plt
|- loc.00400450 12
| 0x00400450 ff 35 32 05 20 00 push qword [rip+0x200532]
\ 0x00400456 ff 25 34 05 20 00 jmp qword [rip+0x200534]
/ (fcn) fcn.0040045c 10
| 0x0040045c 0f 1f 40 00 nop [rax]
/ (fcn) sym.imp.strlen 6
| 0x00400460 ff 25 32 05 20 00 jmp qword [rip+0x200532]
/ (fcn) fcn.00400466 16
| 0x00400466 68 00 00 00 00 push 0x0
| 0x0040046b e9 e0 ff ff ff jmp loc.00400450
'''
a = GtkSource.Buffer()
view = GtkSource.View.new_with_buffer(a)
a.set_text(text)
# Get textiter at coordinates.
start_iter = view.get_iter_at_location(10, 10)
ret = start_iter.backward_find_char(is_word_sep)
Any ideas?
User contributions licensed under CC BY-SA 3.0