Comparing None with QByteArray starting with a null byte is inappropriate/inconsistent

Phil Thompson phil at riverbankcomputing.com
Wed Apr 23 16:57:13 BST 2025


On 23/04/2025 16:34, Maurizio Berti wrote:
> Il giorno mer 23 apr 2025 alle ore 10:28 Phil Thompson <
> phil at riverbankcomputing.com> ha scritto:
> 
>> PyQt5 and PyQt6 behave differently in many ways. If the PyQt5 
>> behaviour
>> is a bug then it will not be fixed - at this stage of its lifecycle
>> consistency with earlier versions is more important than correctness.
>> 
> 
> Thank you for your answer.
> I understand your point, it's quite reasonable.
> 
> Yet, now I'm curious: what caused that bug, and what's changed in PyQt6 
> in
> order to affect the difference?
> 
> MaurizioB

The implementation of the conversion from a Python object is different 
in PyQt6 (it just relies on the buffer protocol). I can't remember if 
the QByteArray implementations are different between Qt5 and Qt6.

I would never use '==' with None anyway. As None is a singleton I always 
use 'is'.

Phil


More information about the PyQt mailing list