Skip to content

Commit a2f0dbf

Browse files
authored
Do not use ClassVars with generic variables (#6348)
1 parent dc5f641 commit a2f0dbf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

stdlib/@python2/ctypes/__init__.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ...
166166
# ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer,
167167
# it can be instantiated directly (to mimic the behavior of the real pointer function).
168168
class pointer(Generic[_CT], _PointerLike, _CData):
169-
_type_: ClassVar[Type[_CT]] = ...
169+
_type_: Type[_CT] = ...
170170
contents: _CT = ...
171171
def __init__(self, arg: _CT = ...) -> None: ...
172172
@overload
@@ -262,8 +262,8 @@ class BigEndianStructure(Structure): ...
262262
class LittleEndianStructure(Structure): ...
263263

264264
class Array(Generic[_CT], _CData):
265-
_length_: ClassVar[int] = ...
266-
_type_: ClassVar[Type[_CT]] = ...
265+
_length_: int = ...
266+
_type_: Type[_CT] = ...
267267
raw: bytes = ... # Note: only available if _CT == c_char
268268
value: Any = ... # Note: bytes if _CT == c_char, Text if _CT == c_wchar, unavailable otherwise
269269
# TODO These methods cannot be annotated correctly at the moment.

stdlib/ctypes/__init__.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ...
173173
# ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer,
174174
# it can be instantiated directly (to mimic the behavior of the real pointer function).
175175
class pointer(Generic[_CT], _PointerLike, _CData):
176-
_type_: ClassVar[Type[_CT]]
176+
_type_: Type[_CT]
177177
contents: _CT
178178
def __init__(self, arg: _CT = ...) -> None: ...
179179
@overload
@@ -268,8 +268,8 @@ class BigEndianStructure(Structure): ...
268268
class LittleEndianStructure(Structure): ...
269269

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

0 commit comments

Comments
 (0)