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

List:       pykde
Subject:    Re: Missing QByteArray(bytes) overload in PyQt6 docs/types
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2023-07-05 12:40:03
Message-ID: cd5fb9c626157560fd3138cbaed99fb6 () riverbankcomputing ! com
[Download RAW message or body]

On 29/06/2023 16:20, Florian Bruhin wrote:
> Hey,
> 
> With PyQt5, help(QByteArray) shows:
> 
>     class QByteArray(sip.simplewrapper)
>      |  QByteArray()
>      |  QByteArray(size: int, c: str)
>      |  QByteArray(a: Union[QByteArray, bytes, bytearray])
> 
> and the type hints also support that.
> 
> However, with PyQt6, it shows:
> 
>     class QByteArray(PyQt6.sip.simplewrapper)
>      |  QByteArray()
>      |  QByteArray(size: int, c: bytes)
>      |  QByteArray(a: QByteArray)
> 
> and the type hints also mark this as wrong:
> 
>     from PyQt6.QtCore import QByteArray
>     print(QByteArray(b"test"))
> 
> See e.g mypy:
> 
>     qba.py:2: error: No overload variant of "QByteArray" matches 
> argument type
> "bytes"  [call-overload]
>     qba.py:2: note: Possible overload variants:
>     qba.py:2: note:     def __init__(self) -> QByteArray
>     qba.py:2: note:     def __init__(self, size: int, c: bytes) -> 
> QByteArray
>     qba.py:2: note:     def __init__(self, a: QByteArray) -> QByteArray
> 
> despite it working fine.
> 
> Florian

Should be fixed in the nest SIP and PyQt6 snapshots.

Thanks,
Phil
[prev in list] [next in list] [prev in thread] [next in thread] 

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