Skip to content
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

"no-member" not triggered for C-extension member but "--unsafe-load-any-extension=y" #9541

Open
buhtz opened this issue Apr 8, 2024 · 0 comments
Labels
Documentation 📗 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling Question

Comments

@buhtz
Copy link

buhtz commented Apr 8, 2024

Question

I do know about the exceptional behavior of PyLint when it comes to c-extensions. I thought I had workaround that but it seems I still misunderstand something.

I expect a no-membe (E1101) error at this line (original code):

    self.colorRed.setColor(QPalette.WindowText, QColor(205, 0, 0))

The class QPalette is imported correct from PyQt6. But the member WindowText do not exit. Correct would be QPalette.ColorRole.WindowText. But PyLint do not see this error.

This is the pylint call I do use to test this:

pylint --disable=E0401,C0301,C0116,W0108,C0209,R0902,R0914,C0411,C0103,W0212,R0915,W0613,C0115,C3001,C0302,W0511,W0702,R1725,C0114,C0415,W0612,R0912,R1705 --extension-pkg-whitelist=PyQt6,PyQt6.QtCore --additional-builtins=_,ngettext --max-line-length=79 --good-names=idx,fp --unsafe-load-any-extension=y settingsdialog.py

So the question for me and my project is if I can configure PyLint in a way that it will give errors on that example line or if I have to live with it that it does not work with PyQt?

Documentation for future user

Don't know because I do not understand the underlying problem.

Additional context

https://github.com/bit-team/backintime/blob/dev/qt/settingsdialog.py#L2271-L2275

I am aware that PyQt6 is doing this "sip" magic. The Python code is somehow auto-generated based on the C-extension or the original C-code. Don't understand the details. I don't know if there is an official git repo having the Python code in it. But I found on my local system a file named .../PyQt6/QtGui.pyi containing the class QPalette and inside of it the enum ColorRole.

image

Looks wired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation 📗 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling Question
Projects
None yet
Development

No branches or pull requests

1 participant