After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 759276 - “Unhandled type tag gunichar” error in GtkTextIter.backward_find_char().
“Unhandled type tag gunichar” error in GtkTextIter.backward_find_char().
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
3.18.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2015-12-09 22:36 UTC by Ender
Modified: 2017-03-30 08:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
closure: support unichar args (1.70 KB, patch)
2017-03-26 17:14 UTC, Christoph Reiter (lazka)
committed Details | Review

Description Ender 2015-12-09 22:36:29 UTC
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 my debugging shows that it 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)
Comment 1 Christoph Reiter (lazka) 2017-03-26 17:14:31 UTC
Created attachment 348741 [details] [review]
closure: support unichar args