pylint
pylint copied to clipboard
False positive: `no-member` when inner function uses the `@classmethod` decorator
Bug description
def test():
@classmethod
def inner(cls):
print(cls.thing)
Pylint seems to think that inner
is a member of the test
object, while in reality, it is not known at this point what inner
might eventually be bound to.
Also note that this issue only occurs when using the @
decorator syntax. With classmethod(inner)
the issue does not occur.
Configuration
No response
Command used
pylint -E a.py
Pylint output
************* Module a
a.py:4:14: E1101: Function 'test' has no 'thing' member (no-member)
Expected behavior
No error.
Pylint version
pylint 2.15.2
astroid 2.12.10
Python 3.10.7 (main, Sep 6 2022, 21:22:27) [GCC 12.2.0]
OS / Environment
No response
Additional dependencies
No response