Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.4.3
-
None
-
0e62a3d99 (dev), 4ccf122a4 (6.7)
Description
Type checker like pyright return an error on function taking an os.PathLike argument
QtCore.QUrl.fromLocalFile("/tmp/testme") => Type of "fromLocalFile" is partially unknown Type of "fromLocalFile" is "(localfile: str | bytes | PathLike[Unknown]) -> QUrl"
This is because os.PathLike typing is defined with a generic class in typeshed
To fix the issue the Qt6 stubs should use os.PathLike[str].
Example in QtCore.pyi:
# replace this def fromLocalFile(localfile: Union[str, bytes, os.PathLike]) -> PySide6.QtCore.QUrl: ... # by this def fromLocalFile(localfile: Union[str, bytes, os.PathLike[str]]) -> PySide6.QtCore.QUrl: ...