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

List:       pykde
Subject:    Missing QByteArray(bytes) overload in PyQt6 docs/types
From:       Florian Bruhin <me () the-compiler ! org>
Date:       2023-06-29 15:20:50
Message-ID: 168805205037.488012.2850604567776936738 () aragog ! localdomain
[Download RAW message or body]


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

[Attachment #3 (application/pgp-signature)]

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

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