mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
[ctypes] update ctypes.CField (#15052)
This commit is contained in:
+37
-15
@@ -1,4 +1,5 @@
|
||||
import _typeshed
|
||||
import builtins
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer
|
||||
from abc import abstractmethod
|
||||
@@ -195,24 +196,45 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType):
|
||||
_GetT = TypeVar("_GetT")
|
||||
_SetT = TypeVar("_SetT")
|
||||
|
||||
# This class is not exposed. It calls itself _ctypes.CField.
|
||||
@final
|
||||
@type_check_only
|
||||
class _CField(Generic[_CT, _GetT, _SetT]):
|
||||
offset: int
|
||||
size: int
|
||||
if sys.version_info >= (3, 10):
|
||||
if sys.version_info >= (3, 14):
|
||||
@final
|
||||
class CField(Generic[_CT, _GetT, _SetT]):
|
||||
offset: int
|
||||
size: int
|
||||
name: str
|
||||
type: builtins.type[_CT]
|
||||
byte_offset: int
|
||||
byte_size: int
|
||||
is_bitfield: bool
|
||||
bit_offset: int
|
||||
bit_size: int
|
||||
is_anonymous: bool
|
||||
@overload
|
||||
def __get__(self, instance: None, owner: type[Any] | None = None, /) -> Self: ...
|
||||
def __get__(self, instance: None, owner: builtins.type[Any] | None = None, /) -> Self: ...
|
||||
@overload
|
||||
def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> _GetT: ...
|
||||
else:
|
||||
@overload
|
||||
def __get__(self, instance: None, owner: type[Any] | None, /) -> Self: ...
|
||||
@overload
|
||||
def __get__(self, instance: Any, owner: type[Any] | None, /) -> _GetT: ...
|
||||
def __get__(self, instance: Any, owner: builtins.type[Any] | None = None, /) -> _GetT: ...
|
||||
def __set__(self, instance: Any, value: _SetT, /) -> None: ...
|
||||
|
||||
def __set__(self, instance: Any, value: _SetT, /) -> None: ...
|
||||
_CField = CField
|
||||
|
||||
else:
|
||||
@final
|
||||
@type_check_only
|
||||
class _CField(Generic[_CT, _GetT, _SetT]):
|
||||
offset: int
|
||||
size: int
|
||||
if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def __get__(self, instance: None, owner: type[Any] | None = None, /) -> Self: ...
|
||||
@overload
|
||||
def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> _GetT: ...
|
||||
else:
|
||||
@overload
|
||||
def __get__(self, instance: None, owner: type[Any] | None, /) -> Self: ...
|
||||
@overload
|
||||
def __get__(self, instance: Any, owner: type[Any] | None, /) -> _GetT: ...
|
||||
|
||||
def __set__(self, instance: Any, value: _SetT, /) -> None: ...
|
||||
|
||||
# This class is not exposed. It calls itself _ctypes.UnionType.
|
||||
@type_check_only
|
||||
|
||||
@@ -55,6 +55,9 @@ if sys.version_info >= (3, 14):
|
||||
else:
|
||||
from _ctypes import POINTER as POINTER, pointer as pointer
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
CField = _CField
|
||||
|
||||
DEFAULT_MODE: Final[int]
|
||||
|
||||
class ArgumentError(Exception): ...
|
||||
|
||||
Reference in New Issue
Block a user