pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.32k stars 1.14k forks source link

Emit no-member for `__annotations__` for py-version < 3.10 #9928

Open l0lawrence opened 2 months ago

l0lawrence commented 2 months ago

I have the following code, with py-version=3.8 specified in my pylintrc:

my_dictionary: TypeOfSomeClass = {}

if key in my_dictionary.__annotations__:  # pylint: disable=no-member
    some code

When I run this in a python 3.8 environment, pylint is happy with no-member being disabled. When I run this in a python 3.10 environment I get a useless-supression error due to the disable on annotations. .[annotations ](https://docs.python.org/3/howto/annotations.html) changes for python 3.10 and above.

Both of these are accurate, however, with py-version=3.8 specified I would expect the same results on python 3.8 and python 3.10. Am I misinterpreting the scope of py-version, is no-member not a version dependent check?

jacobtylerwalls commented 2 months ago

Thanks for the report. Your analysis is correct; this is just a missing feature.