[PyQt] [bug] QFontMetrics Regression in 5.13 on Python2

Chris Billington chrisjbillington at gmail.com
Mon Jul 8 15:18:43 BST 2019


The following example raises an exception on Python 2 with PyQt5 5.13. It
does not raise an exception on Python 3 or on PyQt5 5.12.3.

from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QFontMetrics
app = QApplication([])
QFontMetrics(app.font()).inFont(u'\u2605')

Traceback (most recent call last):
  File "292.py", line 4, in <module>
    QFontMetrics(app.font()).inFont(u'\u2605')
ValueError: string of length 1 expected

This causes tortoisehg to crash for example, as it contains the above
QFontMetrics call. u'\u2605' looks like a string of length one to me, so
this looks like perhaps confounding byte-length with codepoint-length.

regards,

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190708/4a233ba1/attachment.html>


More information about the PyQt mailing list