Staging
v0.5.0
https://foss.heptapod.net/mercurial/hgview
Revision 8ea243e6eed2e7be280d469c03c9d348e5e5cec6 authored by Mads Kiilerich on 13 August 2019, 20:05:00 UTC, committed by Mads Kiilerich on 13 August 2019, 20:05:00 UTC
Evidently a problem that only is seen in some setups, and not in others.

But for example on Fedora Linux, we see
  "AttributeError: 'QString' object has no attribute 'encode'"
evidently from the hgviewlib/qt4/hgrepoviewer.py "compose" with
  to_utf8 = methodcaller('encode', 'utf-8')

The root cause of the problem seems to be that Qt for some reason sometimes in
some setups in some places will return QStrings in some places instead of plain
unicode strings. (On Fedora, I see QString when using Python 2, and plain
unicode str when using Python 3, so I assume that problem has been fixed now.)

It seems quite reasonable that a Qt callback must be able to handle Qt strings.
So let's just handle the problem when we see it, without wrapping the event
handlers with confusing "compose".

The old behaviour of always encoding unicode strings as utf-8 (which be
different than the encoding of the Mercurial repo) also seems questionable, but
don't change that.
1 parent 54fb1b9
History
Tip revision: 8ea243e6eed2e7be280d469c03c9d348e5e5cec6 authored by Mads Kiilerich on 13 August 2019, 20:05:00 UTC
Fix "AttributeError: 'QString' object has no attribute 'encode'" crash on startup
Tip revision: 8ea243e
File Mode Size
bin
debian
doc
hgext3rd
hgviewlib
.hgignore -rw-r--r-- 49 bytes
.hgtags -rw-r--r-- 3.4 KB
COPYING -rw-r--r-- 17.6 KB
ChangeLog -rw-r--r-- 5.7 KB
MANIFEST.in -rw-r--r-- 704 bytes
README -rw-r--r-- 1.8 KB
__pkginfo__.py l--------- 24 bytes
setup.py -rw-r--r-- 14.4 KB

README

back to top