Skip to content

Do not use ClassVars with generic variables #6348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stdlib/@python2/ctypes/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ...
# ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer,
# it can be instantiated directly (to mimic the behavior of the real pointer function).
class pointer(Generic[_CT], _PointerLike, _CData):
_type_: ClassVar[Type[_CT]] = ...
_type_: Type[_CT] = ...
contents: _CT = ...
def __init__(self, arg: _CT = ...) -> None: ...
@overload
Expand Down Expand Up @@ -262,8 +262,8 @@ class BigEndianStructure(Structure): ...
class LittleEndianStructure(Structure): ...

class Array(Generic[_CT], _CData):
_length_: ClassVar[int] = ...
_type_: ClassVar[Type[_CT]] = ...
_length_: int = ...
_type_: Type[_CT] = ...
raw: bytes = ... # Note: only available if _CT == c_char
value: Any = ... # Note: bytes if _CT == c_char, Text if _CT == c_wchar, unavailable otherwise
# TODO These methods cannot be annotated correctly at the moment.
Expand Down
6 changes: 3 additions & 3 deletions stdlib/ctypes/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ...
# ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer,
# it can be instantiated directly (to mimic the behavior of the real pointer function).
class pointer(Generic[_CT], _PointerLike, _CData):
_type_: ClassVar[Type[_CT]]
_type_: Type[_CT]
contents: _CT
def __init__(self, arg: _CT = ...) -> None: ...
@overload
Expand Down Expand Up @@ -268,8 +268,8 @@ class BigEndianStructure(Structure): ...
class LittleEndianStructure(Structure): ...

class Array(Generic[_CT], _CData):
_length_: ClassVar[int]
_type_: ClassVar[Type[_CT]]
_length_: int
_type_: Type[_CT]
raw: bytes # Note: only available if _CT == c_char
value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise
# TODO These methods cannot be annotated correctly at the moment.
Expand Down