PyQt 6.8 regression: str -> QChar in typing stubs

Florian Bruhin me at the-compiler.org
Fri Dec 13 09:01:44 GMT 2024


Hey,

Unfortunately PyQt 6.8 (or sip 6.9.0?) had a small regression I didn't
catch during the prerelease (as I wasn't running mypy against it):

Some arguments and return types that were previously annotated as str
are now wrongly annotated as QChar instead.

Example diff of PyQt6/QtCore.pyi 6.7.1 -> 6.8.0, for QUrlQuery:

    -    def setQueryDelimiters(self, valueDelimiter: str, pairDelimiter: str) -> None: ...
    +    def setQueryDelimiters(self, valueDelimiter: QChar, pairDelimiter: QChar) -> None: ...

Reproducer:

    from PyQt6.QtCore import QUrlQuery
    q = QUrlQuery()
    q.setQueryDelimiters("=", ";")

Resulting mypy output:

    error: Argument 1 to "setQueryDelimiters" of "QUrlQuery" has incompatible type "str";
    expected "QChar"  [arg-type]
        q.setQueryDelimiters("=", ";")


Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20241213/ff45f1e2/attachment.sig>


More information about the PyQt mailing list