[PyQt] QDataStream.writeUInt8 and writeInt8 unfriendly

Mickaël THOMAS mickael9 at gmail.com
Sat May 26 22:24:15 BST 2012


> Type quint8 is an unsigned byte so I think that char is better solution.
> http://qt-project.org/doc/qt-4.8/qdatastream.html#operator-lt-lt-3

What do you mean by "char is a better solution" ?

q(u)int8 is supposed to represent an 8-bit (un)signed number, and the
documentation says "unsigned byte" too, it's not meant to represent a
char.
The problem is that quint8 is typedef unsigned char which leads SIP to
convert it to a python bytes/str because python chars are one-long
strings.
SIP should be modified so that unsigned char is represented as a
python integer (signed char should be still converted to bytes)


More information about the PyQt mailing list