Skip to content

Undefined variable T using generic on Class (PEP695) #9335

Closed
@trentontrees

Description

@trentontrees

Bug description

# pylint: disable=missing-module-docstring
class Simple[T]:
  def __init__(self, value: T):
    self.value = value

Configuration

No response

Command used

python3.12 -m pylint a.py

Pylint output

************* Module a
a.py:3:28: E0602: Undefined variable 'T' (undefined-variable)

Expected behavior

There should be no error E0602 reported.

Pylint version

pylint 3.0.3
astroid 3.0.2
Python 3.12.1 (main, Dec  7 2023, 20:45:44) [Clang 15.0.0 (clang-1500.0.40.1)]

OS / Environment

OSX - Sonoma 14.1.2 (23B92)

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: undefined-variableIssues related to 'undefined-variable' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationpython 3.12

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions