File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,10 @@ modules are added.
115
115
* ``logging-format-interpolation`` and ``logging-not-lazy``, now works on logger
116
116
class created from renamed logging import following an upgrade in astroid.
117
117
118
+ * Fix false-positive ``no-member`` with generic base class
119
+
120
+ Closes PyCQA/astroid#942
121
+
118
122
119
123
What's New in Pylint 2.8.2?
120
124
===========================
Original file line number Diff line number Diff line change 2
2
3
3
# https://github.com/PyCQA/pylint/issues/2822
4
4
# Base should be subscriptable, even with ABCMeta as metaclass
5
- from abc import ABCMeta
5
+ from abc import ABC , ABCMeta
6
6
from typing import Generic , TypeVar
7
7
8
8
T = TypeVar ("T" )
@@ -12,3 +12,21 @@ class Base(Generic[T], metaclass=ABCMeta):
12
12
13
13
class Impl (Base [str ]):
14
14
"""Impl"""
15
+
16
+
17
+ # https://github.com/PyCQA/astroid/issues/942
18
+ Anything = TypeVar ("Anything" )
19
+ MoreSpecific = TypeVar ("MoreSpecific" , str , int )
20
+
21
+ class A (ABC , Generic [Anything ]):
22
+ def a_method (self ) -> None : # pylint: disable=no-self-use
23
+ print ("hello" )
24
+
25
+ class B (A [MoreSpecific ]):
26
+ pass
27
+
28
+ class C (B [str ]):
29
+ pass
30
+
31
+ c = C ()
32
+ c .a_method () # should NOT emit `no-member` error
You can’t perform that action at this time.
0 commit comments