-
-
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
Pylint can't find some PyGObject classes' members #6352
Comments
Hi @Scrashdown, thanks for the report. The |
Latest pylint/astroid has problems with parsing/introspecting GI modules, see pylint-dev/pylint#6352
Based on that, this seems to work correctly with |
This time, the problem seems to be a regression in astroid: pylint-dev/pylint#6352
This time, the problem seems to be a regression in astroid: pylint-dev/pylint#6352
Seems to work correctly with |
So, this is then no longer an issue? |
Not for me, but I'm not the original reporter. |
I can confirm this issue is still present with those versions :
I have the same issue on my code AND on the original reporter's code. |
Hi, I've also hit this issue. The following code is the shortest reproducible case I found. import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
cell = Gtk.CellRendererText()
#cell.props.xalign = 1.0
Gtk.Builder().connect_signals({}) When you run it like this, it works as expected; however, when you uncomment the I did a little bit more digging and found out that in the second (failing) case, following exception is raised in Debug prints in each function in brain_gi.py further showed that in the first case, I found this in astroid 2.12.5 and pylint 2.15.2 with Python 3.7 and 3.11, but I also tried the latest and greatest (astroid 2.15.5 & pylint 2.17.4), and the same issue is still reproducible. I guess I should report this bug in astroid itself? Sadly, I have no idea how astroid works, so I am afraid I won't be able to fix this, but it's a start. |
When importing Gtk, it looks like this: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk It is vital that gi.require_version() is made before related 'from gi.repository import ...'. The brain_gi tries to do that using transforms. And it works unless Gtk is imported as part of delayed assattr handling. Fix this by handling transforms earlier. Fixes pylint-dev#2190 Fixes pylint-dev/pylint#6352
When importing Gtk, it looks like this: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk It is vital that gi.require_version() is made before related 'from gi.repository import ...'. The brain_gi tries to do that using transforms. And it works unless Gtk is imported as part of delayed assattr handling. Fix this by adding early transforms that are called before delayed assattr. Fixes pylint-dev#2190 Fixes pylint-dev/pylint#6352
When importing Gtk, it looks like this: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk It is vital that gi.require_version() is made before related 'from gi.repository import ...'. The brain_gi tries to do that using transforms. And it works unless Gtk is imported as part of delayed assattr handling. Fix this by adding early transforms that are called before delayed assattr. Fixes pylint-dev#2190 Fixes pylint-dev/pylint#6352
When importing Gtk, it looks like this: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk It is vital that gi.require_version() is made before related 'from gi.repository import ...'. The brain_gi tries to do that using transforms. And it works unless Gtk is imported as part of delayed assattr handling. Fix this by adding early transforms that are called before delayed assattr. Fixes pylint-dev#2190 Fixes pylint-dev/pylint#6352
Bug description
Hello,
I have a simple class inheriting from PyGObject's
Gtk.Window
class. Pylint cannotGtk.Window
'sadd
andshow_all
members, yet the code runs fine:Interestingly, if I remove the following line, pylint stops complaining. It looks like adding a member to the MainWindow class which inherits from Gtk.Window throws off pylint.
Configuration
I am using pylint's default configuration.
Command used
Pylint output
Expected behavior
I would expect pylint to find these two members, as they clearly exist since the code runs fine.
Pylint version
OS / Environment
EndeavourOS KDE version
5.17.3-arch1-1 kernel
All packages up-to-date
Additional dependencies
astroid==2.11.2
black==22.3.0
click==8.1.2
dill==0.3.4
isort==5.10.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
mypy==0.942
mypy-extensions==0.4.3
pathspec==0.9.0
platformdirs==2.5.1
pycairo==1.21.0
PyGObject==3.42.0
pylint==2.13.5
tomli==2.0.1
typing_extensions==4.1.1
wrapt==1.14.0
The text was updated successfully, but these errors were encountered: