-
Notifications
You must be signed in to change notification settings - Fork 906
Open
Labels
ai-triage-respondedIndicate whether the AI triage agent has responded to this issue.Indicate whether the AI triage agent has responded to this issue.team needs to reproduceIssue has not been reproduced yetIssue has not been reproduced yet
Description
As the title says the new generic class syntax seems to not be supported class MyClass[T]:
, contrary to the previous formula class MyClass(Generic[T]):
.
New syntax: https://docs.python.org/3/library/typing.html#typing.TypeVar
Environment data
- Pylance version: 2025.8.2
- OS and version: MacOS 15.6.1
- Python version: Python 3.12.11
Code Snippet
from typing import TypeVar, Generic
T = TypeVar("T", int, bytes)
class AA[T]:
def __init__(self, arg: T):
self.arg: T = arg
class BB(Generic[T]):
def __init__(self, arg: T):
self.arg: T = arg
Expected behavior
T
type in both class versions should be recognized and colored in light blue.
Actual behavior
With the new syntax (supported since 3.12) the T
isn't recognized (which is what white color suggest).

Metadata
Metadata
Assignees
Labels
ai-triage-respondedIndicate whether the AI triage agent has responded to this issue.Indicate whether the AI triage agent has responded to this issue.team needs to reproduceIssue has not been reproduced yetIssue has not been reproduced yet