Missing QByteArray(bytes) overload in PyQt6 docs/types
Florian Bruhin
me at the-compiler.org
Thu Jun 29 16:20:50 BST 2023
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20230629/ce6d96cc/attachment.sig>
More information about the PyQt
mailing list