-
-
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
self incorrectly marked as unsubscriptable in list subclass #3930
Comments
@pauladams8 thanks for your report.
gives no message.
|
Sorry, should have been clearer. Upon further testing, the problem occurs only when I subclass the Try this: from typing import List
class TypeHint:
pass
class CustomList(List[TypeHint]):
def first(self):
# pylint alerts me "Value 'self' is unsubscriptable", which is incorrect
return self[0] Additionally, pylint incorrectly reports errors when
When getting and setting custom properties:
It seems these errors are not present with a type hint. To reproduce this, use the sample above but without the |
pylint also reports incorrectly on
Test sample as above, with additional method def has_foo(self):
return 'foo' in self |
@pauladams8 thanks for this update. I can now reproduce it. |
@pauladams8 I wasn't able to reproduce any of the errors with the latest version of pylint. We improved the handling of the If you still experience issues, please report back and I'll reopen it. |
Steps to reproduce
list
classself
from within the classExample
Current behavior
pylint produces error
Expected behavior
No alert from pylint
pylint --version output
pylint 2.6.0
astroid 2.4.2
Python 3.8.5 (default, Jul 21 2020, 10:48:26)
[Clang 11.0.3 (clang-1103.0.32.62)]
The text was updated successfully, but these errors were encountered: