-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
False-positive signature-differs
/ arguments-differ
with typing.overload
#5264
Comments
@cdce8p I narrowed down the issue with selecting the first overload instead of the actual signature due to the This returns Do we want to fix this in |
* qt brain: Make slot argument optional for disconnect() Discussed here: #1531 (comment) PyQt supports calling .disconnect() without any arguments in order to disconnect all slots: https://www.riverbankcomputing.com/static/Docs/PyQt6/signals_slots.html#disconnect Strictly speaking, slot=None is a wrong call, as actually passing None does not work: python-qt-tools/PyQt5-stubs#103 However, pylint/astroid does not support overloads needed to properly express this: pylint-dev/pylint#5264 So, while this is "wrong", it's less wrong than before - without this change, pylint expects a mandatory argument, thus raising a false-positive here: from PyQt5.QtCore import QTimer t = QTimer() t.timeout.connect(lambda: None) t.timeout.disconnect() despite running fine, pylint complains: test.py:4:0: E1120: No value for argument 'slot' in method call (no-value-for-parameter) while with this change, things work fine.
* qt brain: Make slot argument optional for disconnect() Discussed here: #1531 (comment) PyQt supports calling .disconnect() without any arguments in order to disconnect all slots: https://www.riverbankcomputing.com/static/Docs/PyQt6/signals_slots.html#disconnect Strictly speaking, slot=None is a wrong call, as actually passing None does not work: python-qt-tools/PyQt5-stubs#103 However, pylint/astroid does not support overloads needed to properly express this: pylint-dev/pylint#5264 So, while this is "wrong", it's less wrong than before - without this change, pylint expects a mandatory argument, thus raising a false-positive here: from PyQt5.QtCore import QTimer t = QTimer() t.timeout.connect(lambda: None) t.timeout.disconnect() despite running fine, pylint complains: test.py:4:0: E1120: No value for argument 'slot' in method call (no-value-for-parameter) while with this change, things work fine.
* qt brain: Make slot argument optional for disconnect() Discussed here: #1531 (comment) PyQt supports calling .disconnect() without any arguments in order to disconnect all slots: https://www.riverbankcomputing.com/static/Docs/PyQt6/signals_slots.html#disconnect Strictly speaking, slot=None is a wrong call, as actually passing None does not work: python-qt-tools/PyQt5-stubs#103 However, pylint/astroid does not support overloads needed to properly express this: pylint-dev/pylint#5264 So, while this is "wrong", it's less wrong than before - without this change, pylint expects a mandatory argument, thus raising a false-positive here: from PyQt5.QtCore import QTimer t = QTimer() t.timeout.connect(lambda: None) t.timeout.disconnect() despite running fine, pylint complains: test.py:4:0: E1120: No value for argument 'slot' in method call (no-value-for-parameter) while with this change, things work fine.
The first example was fixed in 2.15.0-dev0, not the second one. |
Bug description
Noticed that one while working on pylint-dev/astroid#1217 with @DanielNoord.
The logic for
signature-differs
/arguments-differ
can't handle function redefinitions as its common withtyping.overload
. In particular I narrowed it down to two issue:overload
.--
The examples require Python 3.8 (due to the use of
typing.Literal
). Not that they aren'T necessarily typed correctly. Just for illustration proposes.Example 1
Example 2
Configuration
No response
Command used
Pylint output
Expected behavior
no errors
Pylint version
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: