-
-
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
Crash when linting LeoQt #6438
Comments
@edreamleo I think this is a duplicate of #6437 right? |
@DanielNoord I don't think so, but I can't be sure. Afaik, I am running the latest pylint code. |
@DanielNoord I pulled from master before testing. |
Sorry, should have been clearer! I meant the file that crashes: |
Sorry, this comment was all wrong. I was mistaking #6437 (a duplicate) with my much-earlier issue. |
@DanielNoord Oops. I didn't ping you in the last comment. |
Hmm are you sure |
@DanielNoord I don't understand your comment:
|
@DanielNoord At last I see what you mean. The title of this issue is incorrect. |
@DanielNoord The title should be something like: |
@DanielNoord Or maybe the title is correct. I'm not sure. |
@edreamleo Could you please re-check #6437 and make sure you have filed the correct data there? As I see it these are both issues reporting a traceback due to an Both of these I'm not sure where the issue title for both issues comes from but indeed As to the |
@DanielNoord My apologies. I didn't realized I had filed #6437. I have just closed it as a duplicate. |
@DanielNoord Here is what appears to be the smallest file illustrating the bug. # This file crashes pylint. Based on leo/plugins/freewin.py.
qt_imports_ok = False
try:
from leo.core.leoQt import QtCore, QtWidgets, QtGui
qt_imports_ok = True
except ImportError as e:
g.trace(e)
# The crash does not happen without these aliases.
QPushButton = QtWidgets.QPushButton
QTextEdit = QtWidgets.QTextEdit
QWidget = QtWidgets.QWidget
class ZEditorWin(QtWidgets.QMainWindow):
def __init__(self, c, title='Z-editor'):
super().__init__()
self.editor = QTextEdit()
self.central_widget = central_widget = QWidget()
central_widget.setLayout(layout)
self.setCentralWidget(central_widget)
if got_docutils:
dummy = publish_string('dummy', writer_name='html').decode(ENCODING)
self.browser.setHtml(dummy)
central_widget.keyPressEvent = self.keyPressEvent
# The crash does not happen if this method does not exist.
def keyPressEvent(self, event):
pass |
Hi everyone! Windows 10, Ubuntu 18.04 LTS
Code example: class ConfigDialog(QDialog):
def __init__():
ok_btn = QPushButton('Ok')
cancel_btn = QPushButton('Cancel')
ok_btn.clicked.connect(self.accept)
cancel_btn.clicked.connect(self.reject) PyLint error for last code lines: But Thanks! |
I believe the issue @edreamleo originally reported ( In my project, I don't see the crash, but I do see around 100 new false-positives with what @a-sidorova mentions (unfortunately making this update unusable for me). Even simpler example for the latter: from PyQt5.QtCore import QTimer
timer = QTimer()
timer.timeout.connect(lambda: None) (note that Using this, I was able to bisect the issue to pylint-dev/astroid#1505 (namely pylint-dev/astroid@6b1bf6c), a fix for #6221. cc @jacobtylerwalls. As for the crash reported by @edreamleo, the reproducer relies on # This file crashes pylint. Based on leo/plugins/freewin.py.
from PyQt5 import QtCore, QtWidgets, QtGui
# The crash does not happen without these aliases.
QPushButton = QtWidgets.QPushButton
QTextEdit = QtWidgets.QTextEdit
QWidget = QtWidgets.QWidget
class ZEditorWin(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
central_widget = QWidget()
central_widget.keyPressEvent = self.keyPressEvent
# The crash does not happen if this method does not exist.
def keyPressEvent(self, event):
pass That one happens even with pylint 2.13.5 and astroid 2.11.2, so contrary to the false positives, does not seem to be a recent regression. |
@The-Compiler Thanks for your investigations. |
Thanks @The-Compiler, your reproducers are extremely helpful. I'll refocus this one on the crash, and I'll open a new one for the false positive for We have quite a few open tickets for |
Bug description
pylint crashes as shown below.
Note: Perhaps due to the long bug report I had trouble at first filling in the various sections. I think I have the desired data now, but I did have to create a new section for the program under test.
Configuration
No response
Command used
Pylint output
The crash shown in the details above.
Expected behavior
No crash.
Pylint version
OS / Environment
Leo 6.6.1-devel, devel branch, build 6f62bc8c3c
2022-04-22 08:12:19 -0500
Python 3.10.4, PyQt version 6.2.4
Windows 10 AMD64 (build 10.0.22000) SP0
Additional dependencies
Program that crashed
If this issue survives triage I'll be happy to attempt to condense this program to a shorter version that fails.
</ details>
The text was updated successfully, but these errors were encountered: