Closed
Description
Bug description
The behavior described in #9193 is still observable with pylint 3.0.3 for classes.
class Foo[T]:
def __init__(self, value: T):
self.value = value
x = Foo[int](1)
Works fine but T
is marked as an undefined variable, and Foo
is marked unsubscriptable.
Configuration
No response
Command used
pylint foo.py
Pylint output
************* Module foo
foo.py:1:0: C0114: Missing module docstring (missing-module-docstring)
foo.py:1:0: C0104: Disallowed name "foo" (disallowed-name)
foo.py:1:0: C0115: Missing class docstring (missing-class-docstring)
foo.py:2:30: E0602: Undefined variable 'T' (undefined-variable)
foo.py:1:0: R0903: Too few public methods (0/2) (too-few-public-methods)
foo.py:6:4: E1136: Value 'Foo' is unsubscriptable (unsubscriptable-object)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
Expected behavior
There should be no E0602 or E1136.
Pylint version
pylint 3.0.3
astroid 3.0.2
Python 3.12.0 (main, Dec 4 2023, 20:32:31) [Clang 15.0.0 (clang-1500.0.40.1)]
OS / Environment
macOS 14.2.1 / Apple M2 Max
Additional dependencies
No response