[PyQt] QDataStream.writeUInt8 and writeInt8 unfriendly
Jarosław Białas
jarekbialas.bialy at gmail.com
Sat May 26 21:02:24 BST 2012
Hi,
2012/5/26 Mickaël THOMAS <mickael9 at gmail.com>:
> Hi,
>
> I wanted to point out a very odd behavior (which is not that odd
> actually, but still...)
>
> The documentation says that QDataStream.writeUInt8 and
> QDataStream.writeInt8 should be passed a str rather than an int, which
> looks strange to me.
>
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qdatastream.html#writeInt8
>
> So to write 0x80, you need to write the following in Python2 :
> datastream.writeInt8(chr(0x80))
>
> And worse in Python3 :
> datastream.writeInt8(bytes([0x80]))
>
> I definitely think that quint8 should be converted to/from an int
> rather than a char.
>
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's your thoughts on this?
>
> Regards,
> Mickael
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Regards,
Jarek
More information about the PyQt
mailing list