PyQt 6.8 regression: str -> QChar in typing stubs
Phil Thompson
phil at riverbankcomputing.com
Fri Dec 13 12:32:03 GMT 2024
On 13/12/2024 09:01, Florian Bruhin wrote:
> 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
Should be fixed in the next snapshot.
Thanks,
Phil
More information about the PyQt
mailing list