typing.cast
is ignored in case of no-member
error checker
#6784
Labels
Duplicate 🐫
Duplicate of an already existing issue
High effort 🏋
Difficult solution or problem to solve
Proposal 📨
Bug description
In following code Pylint reports
no-member
error. It's right, becauselist_wrapper
hasn't such member. I usedtyping.cast
and type annotations to force Pylint to think, thatlist_wrapper
has different type, but Pylint ignores it.Of course, this simplified example has no sense and such Python code will always fail at runtime. I have a little bit more complicated real use case, with
__setattr__
and__getattr__
methods, where I assign to member variable such wrapper, like in example above, but overridden__getattr__
will return different type, which will not cause error at runtime. I wanted to usetyping.cast
to inform Pylint, that returned types for member variables will be different, but it has no effect.I am not sure if it is a bug or I am using Pylint incorrectly. I can prepare simplified example of my real use case if it would be helpful.
Configuration
No response
Command used
Pylint output
Expected behavior
No error reported.
Pylint version
OS / Environment
Ubuntu 20.04.4 LTS
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: