-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
I just implemented a check in pyright to report an error if a TypeVar is used within a ClassVar declaration. PEP 526 specifically says:
Note that a ClassVar parameter cannot include any type variables, regardless of the level of nesting: ClassVar[T] and ClassVar[List[Set[T]]] are both invalid if T is a type variable.
A similar feature request was recently filed in the mypy issue tracker.
Here's the issue in the pyright issue tracker: microsoft/pyright#2567.
This check is highlighting a problem in the pointer class defined within the ctypes/__init__.pyi stub.
class pointer(Generic[_CT], _PointerLike, _CData):
_type_: ClassVar[Type[_CT]]I don't know enough about ctypes to suggest a proper fix.
Metadata
Metadata
Assignees
Labels
No labels