[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QDataStream.writeUInt8 and writeInt8 unfriendly
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2012-05-31 16:43:16
Message-ID: 2087b21f35f70dfd536ba351e475659d () localhost
[Download RAW message or body]

On Sat, 26 May 2012 23:24:15 +0200, Mickaƫl THOMAS <mickael9@gmail.com>
wrote:
>> 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)

I'm inclined to think that both writeUInt8() and writeInt8() should accept
numeric arguments. That would be easy enough to fix without breaking
existing code (just add new overloads), but then the behaviour of
readUInt8() and readInt8() would then become inconsistent as they couldn't
also be fixed.

Therefore I'm inclined to leave things as they are, but fix it properly in
PyQt5.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic