@@ -6,7 +6,7 @@ from abc import abstractmethod
66from collections .abc import Callable , Iterable , Iterator , Mapping , Sequence
77from ctypes import CDLL , ArgumentError as ArgumentError , c_void_p
88from types import GenericAlias
9- from typing import Any , ClassVar , Final , Generic , Literal , TypeVar , final , overload , type_check_only
9+ from typing import Any , ClassVar , Final , Generic , Literal , SupportsIndex , TypeVar , final , overload , type_check_only
1010from typing_extensions import Self , TypeAlias
1111
1212_T = TypeVar ("_T" )
@@ -134,7 +134,7 @@ class _Pointer(_PointerLike, _CData, Generic[_CT], metaclass=_PyCPointerType):
134134 @overload
135135 def __getitem__ (self , key : int , / ) -> Any : ...
136136 @overload
137- def __getitem__ (self , key : slice , / ) -> list [Any ]: ...
137+ def __getitem__ (self , key : slice [ SupportsIndex | None ] , / ) -> list [Any ]: ...
138138 def __setitem__ (self , key : int , value : Any , / ) -> None : ...
139139
140140if sys .version_info < (3 , 14 ):
@@ -320,7 +320,11 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
320320 def _type_ (self ) -> type [_CT ]: ...
321321 @_type_ .setter
322322 def _type_ (self , value : type [_CT ]) -> None : ...
323- raw : bytes # Note: only available if _CT == c_char
323+ # Note: only available if _CT == c_char
324+ @property
325+ def raw (self ) -> bytes : ...
326+ @raw .setter
327+ def raw (self , value : ReadableBuffer ) -> None : ...
324328 value : Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise
325329 # TODO: These methods cannot be annotated correctly at the moment.
326330 # All of these "Any"s stand for the array's element type, but it's not possible to use _CT
@@ -338,11 +342,11 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
338342 @overload
339343 def __getitem__ (self , key : int , / ) -> Any : ...
340344 @overload
341- def __getitem__ (self , key : slice , / ) -> list [Any ]: ...
345+ def __getitem__ (self , key : slice [ SupportsIndex | None ] , / ) -> list [Any ]: ...
342346 @overload
343347 def __setitem__ (self , key : int , value : Any , / ) -> None : ...
344348 @overload
345- def __setitem__ (self , key : slice , value : Iterable [Any ], / ) -> None : ...
349+ def __setitem__ (self , key : slice [ SupportsIndex | None ] , value : Iterable [Any ], / ) -> None : ...
346350 def __iter__ (self ) -> Iterator [Any ]: ...
347351 # Can't inherit from Sized because the metaclass conflict between
348352 # Sized and _CData prevents using _CDataMeta.
0 commit comments