Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
None
-
6.6.2
-
None
-
5825e86a3 (dev), 5c92412b2 (6.8)
Description
Type checkers/IDEs propose keyword arguments for PySide function calls, but these do not work:
python -c "from PySide6.QtCore import QUrl; QUrl.setIdnWhitelist(arg1=[''])" Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: QUrl.setIdnWhitelist() takes no keyword arguments
I think PySide stubs should use the positional-only syntax which was introduced in Python 3.8 (https://peps.python.org/pep-0570/). Here's some example code showing the issue:
from PySide6.QtCore import QUrl from collections.abc import Sequence # this works QUrl.setIdnWhitelist([""]) # QtCore.pyi: # def def setIdnWhitelist(arg__1: Sequence[str]) -> None: ... # this fails QUrl.setIdnWhitelist(arg__1=[""]) # TypeError: QUrl.setIdnWhitelist() takes no keyword arguments # Using "/" lets type checkers know that parameters should be keyword-only def mySetIdnWhitelist(arg__1: Sequence[str], /) -> None: ... # this is reported by type checkers mySetIdnWhitelist(arg__1=[""])