|
1 | 1 | import _typeshed |
| 2 | +import builtins |
2 | 3 | import sys |
3 | 4 | from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer |
4 | 5 | from abc import abstractmethod |
@@ -195,24 +196,45 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType): |
195 | 196 | _GetT = TypeVar("_GetT") |
196 | 197 | _SetT = TypeVar("_SetT") |
197 | 198 |
|
198 | | -# This class is not exposed. It calls itself _ctypes.CField. |
199 | | -@final |
200 | | -@type_check_only |
201 | | -class _CField(Generic[_CT, _GetT, _SetT]): |
202 | | - offset: int |
203 | | - size: int |
204 | | - if sys.version_info >= (3, 10): |
205 | | - @overload |
206 | | - def __get__(self, instance: None, owner: type[Any] | None = None, /) -> Self: ... |
207 | | - @overload |
208 | | - def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> _GetT: ... |
209 | | - else: |
| 199 | +if sys.version_info >= (3, 14): |
| 200 | + @final |
| 201 | + class CField(Generic[_CT, _GetT, _SetT]): |
| 202 | + offset: int |
| 203 | + size: int |
| 204 | + name: str |
| 205 | + type: builtins.type[_CT] |
| 206 | + byte_offset: int |
| 207 | + byte_size: int |
| 208 | + is_bitfield: bool |
| 209 | + bit_offset: int |
| 210 | + bit_size: int |
| 211 | + is_anonymous: bool |
210 | 212 | @overload |
211 | | - def __get__(self, instance: None, owner: type[Any] | None, /) -> Self: ... |
| 213 | + def __get__(self, instance: None, owner: builtins.type[Any] | None = None, /) -> Self: ... |
212 | 214 | @overload |
213 | | - def __get__(self, instance: Any, owner: type[Any] | None, /) -> _GetT: ... |
| 215 | + def __get__(self, instance: Any, owner: builtins.type[Any] | None = None, /) -> _GetT: ... |
| 216 | + def __set__(self, instance: Any, value: _SetT, /) -> None: ... |
| 217 | + |
| 218 | + _CField = CField |
214 | 219 |
|
215 | | - def __set__(self, instance: Any, value: _SetT, /) -> None: ... |
| 220 | +else: |
| 221 | + @final |
| 222 | + @type_check_only |
| 223 | + class _CField(Generic[_CT, _GetT, _SetT]): |
| 224 | + offset: int |
| 225 | + size: int |
| 226 | + if sys.version_info >= (3, 10): |
| 227 | + @overload |
| 228 | + def __get__(self, instance: None, owner: type[Any] | None = None, /) -> Self: ... |
| 229 | + @overload |
| 230 | + def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> _GetT: ... |
| 231 | + else: |
| 232 | + @overload |
| 233 | + def __get__(self, instance: None, owner: type[Any] | None, /) -> Self: ... |
| 234 | + @overload |
| 235 | + def __get__(self, instance: Any, owner: type[Any] | None, /) -> _GetT: ... |
| 236 | + |
| 237 | + def __set__(self, instance: Any, value: _SetT, /) -> None: ... |
216 | 238 |
|
217 | 239 | # This class is not exposed. It calls itself _ctypes.UnionType. |
218 | 240 | @type_check_only |
|
0 commit comments