-
I ran across this false negative and I'm not sure if this is an issue with PySide6 (6.8.0) or Pyright. Below is an example where I expect a type error at Is this an issue with PySide6 or Pyright? from PySide6.QtCore import QObject, Slot
class FloatObject(QObject):
def __init__(self):
super().__init__()
self.b = BytesObject()
def write_float(self, data: float):
self.b.write_bytes(data) # expect type error here
class BytesObject(QObject):
@Slot(bytes) # removing this line will trigger type error
def write_bytes(self, data: bytes):
pass |
Beta Was this translation helpful? Give feedback.
Answered by
erictraut
Jan 27, 2025
Replies: 1 comment 6 replies
-
When I install the latest version of Pyside6 (6.8.1.1), pyright gives me a type checking error in the code above:
Are you seeing this error? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pyside6 6.8.0 wouldn't install for me. It appears it's not compatible with Python 3.13. I was able to get it to install by reverting to an older version of Python.
The Pyside6 6.8.0 library defines the
Slots
class in a way that obscures all type information if you apply the class as a decorator. That's why you're not seeing an type error here. This isn't a bug in pyright; it's arguably a bug in the library's type annotations. And it appears that it has been fixed in a later version (6.8.1.1).