-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Needs astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergableNeeds investigation 🔬A bug or crash where it's not immediately obvious what is happenningA bug or crash where it's not immediately obvious what is happenning
Description
Very similar to #9159, pylint is unable to resolve typing.Self from base classes even when the method in question is not overridden (as it is in #9159)
Bug description
import typing
class A:
def parent_meth(self) -> typing.Self:
return self
class B(A):
def meth(self) -> typing.Self:
return super().parent_meth()
def f2(self):
pass
B().meth().f2()Configuration
Command used
pylint test.pyPylint output
************* Module test
test.py:4:0: R0903: Too few public methods (1/2) (too-few-public-methods)
test.py:17:0: E1101: Instance of 'A' has no 'f2' member (no-member)Expected behavior
B().meth() should resolve to type B, thereby exposing f2()
Pylint version
$ pylint --version
pylint 4.0.2
astroid 4.0.2
Python 3.12.6 (main, Oct 9 2024, 11:19:43) [GCC 13.2.0]OS / Environment
No response
Additional dependencies
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergableNeeds investigation 🔬A bug or crash where it's not immediately obvious what is happenningA bug or crash where it's not immediately obvious what is happenning