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 690329 - Can't call a Gtk.UIManager.add_ui_from_string() containing (too much) non-ASCII characters
Can't call a Gtk.UIManager.add_ui_from_string() containing (too much) non-ASC...
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
3.3.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
: 690921 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-12-17 09:01 UTC by Jonathan Ballet
Modified: 2013-01-01 10:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Show case for the bug (341 bytes, application/octet-stream)
2012-12-17 09:01 UTC, Jonathan Ballet
  Details
Show case for the bug (333 bytes, application/octet-stream)
2012-12-27 12:11 UTC, Jonathan Ballet
  Details
GDB Session whiich shows the problem related to length (2.76 KB, application/octet-stream)
2012-12-27 12:17 UTC, Jonathan Ballet
  Details
Proposed fix (447 bytes, patch)
2012-12-27 12:17 UTC, Jonathan Ballet
none Details | Review

Description Jonathan Ballet 2012-12-17 09:01:03 UTC
Created attachment 231703 [details]
Show case for the bug

Launching the attached file using Python 3 generates the following output:

$ python3 test-uimanager-unicode.py
1
2
Traceback (most recent call last):
  • File "test-uimanager-unicode.py", line 22 in <module>
    u.add_ui_from_string(ui % "éé")
  • File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 297 in add_ui_from_string
    return Gtk.UIManager.add_ui_from_string(self, buffer, length)
  • File "/usr/lib/python3/dist-packages/gi/types.py", line 47 in function
    return info.invoke(*args, **kwargs)
gi._glib.GError: Error on line 7 char 6: Document ended unexpectedly inside the close tag for element 'ui'

It doesn't cause this problem with Python 2, unless I decode the string first from UTF-8 and pass a Unicode string to add_ui_from_string()

Note that it fails with "several" non-ASCII characters, but works with only one non-ASCII characters.

I get the problem on Debian Sid, running python 3.2.3-6, python3-gi 3.3.91-1, but I got the problem originally from this bug report: https://github.com/multani/sonata/issues/27 (ArchLinux, different versions of the libraries).
Comment 1 Jonathan Ballet 2012-12-27 12:11:32 UTC
Created attachment 232260 [details]
Show case for the bug

Simpler show case
Comment 2 Jonathan Ballet 2012-12-27 12:17:01 UTC
Created attachment 232261 [details]
GDB Session whiich shows the problem related to length
Comment 3 Jonathan Ballet 2012-12-27 12:17:37 UTC
Created attachment 232262 [details] [review]
Proposed fix
Comment 4 Martin Pitt 2012-12-27 15:13:31 UTC
Thanks! Applied with a test case in

http://git.gnome.org/browse/pygobject/commit/?id=948dbcb223249a08f4398d4ad8861e92e3de0dfa
Comment 5 Martin Pitt 2012-12-31 15:38:59 UTC
*** Bug 690921 has been marked as a duplicate of this bug. ***
Comment 6 Benny Malengier 2012-12-31 18:10:19 UTC
Thanks! I searched in the bug list on add_ui_from_string, but did not see this one. It is somewhat annoying the version here says only Version: 3.3.x

What does that mean for the version in which this fix will be?
Comment 7 John Ralls 2012-12-31 23:02:29 UTC
Benny, 3.3.x is the version that the OP was using when he reported it. Unlike Mantis, Gnome's Bugzilla doesn't record the version in which it was fixed.

The commit was made to pygobject master and not backported, so it will go in the next unstable release (3.7.4) on the 14th and the eventual stable release (3.8.0) on 25 March.

See https://live.gnome.org/ThreePointSeven for the release schedule.
Comment 8 Martin Pitt 2013-01-01 10:49:47 UTC
This patch is backportable to 3.6 in principle, but as far as I can see on https://live.gnome.org/ThreePointSeven there is no further GNOME 3.6.3 release planned.