Skip to content

add default for owner parameter of pyqtSignal.__get__() #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 22, 2022
Merged

Conversation

altendky
Copy link
Collaborator

https://github.com/python-qt-tools/PyQt5-stubs/actions/runs/3485949394/jobs/5831945350#step:7:111

error: PyQt5.QtCore.pyqtSignal.__get__ is inconsistent, runtime argument "owner" has a default value but stub argument does not

https://github.com/python-qt-tools/PyQt5-stubs/actions/runs/3485949394/jobs/5831945350#step:7:111
> `error: PyQt5.QtCore.pyqtSignal.__get__ is inconsistent, runtime argument "owner" has a default value but stub argument does not`
Copy link
Collaborator

@The-Compiler The-Compiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really need to be conditional? Looking at the commit history, it looks like the Optional is what made it work. From reading the Python 3.8 reference and even the original 2001 PEP (__get__(): a function callable with one or two arguments), it looks like this would be the correct annotation even for older Python versions.

@altendky
Copy link
Collaborator Author

Adding Optional with a ... default fails on everything except 3.10.
#200
https://github.com/python-qt-tools/PyQt5-stubs/actions/runs/3508337017/jobs/5876674894#step:7:111

error: PyQt5.QtCore.pyqtSignal.__get__ is inconsistent, stub argument "owner" has a default value but runtime argument does not
Stub: at line 58
Overload(def (self: PyQt5.QtCore.pyqtSignal, instance: None, owner: Union[Type[PyQt5.QtCore.QObject], None] =) -> PyQt5.QtCore.pyqtSignal, def (self: PyQt5.QtCore.pyqtSignal, instance: PyQt5.QtCore.QObject, owner: Union[Type[PyQt5.QtCore.QObject], None] =) -> PyQt5.QtCore.pyqtBoundSignal)
Inferred signature: def (self: PyQt5.QtCore.pyqtSignal, instance: Union[None, PyQt5.QtCore.QObject], owner: Union[Type[PyQt5.QtCore.QObject], None] = ...)
Runtime:
def (self, instance, owner, /)

Adding just Optional fails only on 3.10.
#201
https://github.com/python-qt-tools/PyQt5-stubs/actions/runs/3508353763/jobs/5876702368#step:7:111

error: PyQt5.QtCore.pyqtSignal.__get__ is inconsistent, runtime argument "owner" has a default value but stub argument does not
Stub: at line 58
Overload(def (self: PyQt5.QtCore.pyqtSignal, instance: None, owner: Union[Type[PyQt5.QtCore.QObject], None]) -> PyQt5.QtCore.pyqtSignal, def (self: PyQt5.QtCore.pyqtSignal, instance: PyQt5.QtCore.QObject, owner: Union[Type[PyQt5.QtCore.QObject], None]) -> PyQt5.QtCore.pyqtBoundSignal)
Inferred signature: def (self: PyQt5.QtCore.pyqtSignal, instance: Union[None, PyQt5.QtCore.QObject], owner: Union[Type[PyQt5.QtCore.QObject], None])
Runtime:
def (self, instance, owner=None, /)

And yeah, this does feel odd that the Python version is changing the same compiled version of PyQt's presence or lack of a parameter default... We are on mypy 0.930, so there's that. And 0.991 segfaults on the stubtest run so...

https://github.com/python-qt-tools/PyQt5-stubs/actions/runs/3508399647/jobs/5876778073#step:7:111

ERROR: InvocationError for command /home/runner/work/PyQt5-stubs/PyQt5-stubs/.tox/py310-linux/bin/stubtest --allowlist stubtest.allowlist --allowlist stubtest.allowlist.to_review --allowlist stubtest.allowlist.linux PyQt5 (exited with code -11 (SIGSEGV)) (exited with code -11)

@altendky
Copy link
Collaborator Author

We're also on PyQt 5.15.6 not 5.15.7.

Copy link
Collaborator

@The-Compiler The-Compiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird! But ok, let's do this, to make stubtest happy.

@altendky altendky merged commit 4634aba into master Nov 22, 2022
@altendky altendky deleted the fixup_ci branch November 22, 2022 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants