* Jeremy Bicha <jbi...@debian.org>, 2019-01-11, 15:36:
plugins/snippets/snippets/document.py contains the following code:

  cv = GLib.convert(s, -1, enc.get_charset(), 'UTF-8')

But GLib.convert() takes 3 arguments, not 4, so this will always fail with TypeError.

Do you have a sample file to help trigger the bug?

Difficult question. :-) I've never used gedit before. I noticed the bug by reading the code.

But OK, this is how you can trigger this:

1) Enable the "Snippets" plugin in settings.

2) Run:

  echo foo | iconv -t UTF-16 > foo.html
  gedit foo.html

3) Type "head" and press Tab.

You should get the following traceback:

  Traceback (most recent call last):
    File "/usr/lib/i386-linux-gnu/gedit/plugins/snippets/document.py", line 
852, in on_view_key_press
      return self.run_snippet()
    File "/usr/lib/i386-linux-gnu/gedit/plugins/snippets/document.py", line 
692, in run_snippet
      if not self.run_snippet_trigger(word, (start, end)):
    File "/usr/lib/i386-linux-gnu/gedit/plugins/snippets/document.py", line 
664, in run_snippet_trigger
      return self.apply_snippet(snippets[0], bounds[0], bounds[1])
    File "/usr/lib/i386-linux-gnu/gedit/plugins/snippets/document.py", line 
527, in apply_snippet
      env = self.get_environment()
    File "/usr/lib/i386-linux-gnu/gedit/plugins/snippets/document.py", line 
491, in get_environment
      v = variables[var](buf)
    File "/usr/lib/i386-linux-gnu/gedit/plugins/snippets/document.py", line 
345, in env_get_current_word
      return {'utf8': u8, 'noenc': self.string_in_native_doc_encoding(buf, u8)}
    File "/usr/lib/i386-linux-gnu/gedit/plugins/snippets/document.py", line 
323, in string_in_native_doc_encoding
      cv = GLib.convert(s, -1, enc.get_charset(), 'UTF-8')
  TypeError: GLib.convert() takes exactly 3 arguments (4 given)

--
Jakub Wilk

Reply via email to