Update _ctypes to 3.14 (#14043)

This commit is contained in:
sobolevn
2025-05-13 14:29:49 +03:00
committed by GitHub
parent f8b0eec26c
commit bc244028d7
3 changed files with 27 additions and 17 deletions
@@ -5,9 +5,6 @@
_asyncio.all_tasks
_asyncio.future_add_to_awaited_by
_asyncio.future_discard_from_awaited_by
_ctypes.POINTER
_ctypes.byref
_ctypes.pointer
_heapq.heapify_max
_heapq.heappop_max
_heapq.heappush_max
@@ -54,10 +51,7 @@ compression.gzip.GzipFile.readinto1
compression.gzip.GzipFile.readinto1
compression.gzip.compress
compression.zstd
ctypes.POINTER
ctypes.byref
ctypes.memoryview_at
ctypes.pointer
ctypes.py_object.__class_getitem__
ctypes.util.dllist
ctypes.wintypes.HCONV
+11 -6
View File
@@ -131,18 +131,23 @@ class _Pointer(_PointerLike, _CData, Generic[_CT], metaclass=_PyCPointerType):
def __getitem__(self, key: slice, /) -> list[Any]: ...
def __setitem__(self, key: int, value: Any, /) -> None: ...
@overload
def POINTER(type: None, /) -> type[c_void_p]: ...
@overload
def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]: ...
def pointer(obj: _CT, /) -> _Pointer[_CT]: ...
if sys.version_info < (3, 14):
@overload
def POINTER(type: None, /) -> type[c_void_p]: ...
@overload
def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]: ...
def pointer(obj: _CT, /) -> _Pointer[_CT]: ...
# This class is not exposed. It calls itself _ctypes.CArgObject.
@final
@type_check_only
class _CArgObject: ...
def byref(obj: _CData | _CDataType, offset: int = ...) -> _CArgObject: ...
if sys.version_info >= (3, 14):
def byref(obj: _CData | _CDataType, offset: int = 0, /) -> _CArgObject: ...
else:
def byref(obj: _CData | _CDataType, offset: int = 0) -> _CArgObject: ...
_ECT: TypeAlias = Callable[[_CData | _CDataType | None, CFuncPtr, tuple[_CData | _CDataType, ...]], _CDataType]
_PF: TypeAlias = tuple[int] | tuple[int, str | None] | tuple[int, str | None, Any]
+16 -5
View File
@@ -1,6 +1,5 @@
import sys
from _ctypes import (
POINTER as POINTER,
RTLD_GLOBAL as RTLD_GLOBAL,
RTLD_LOCAL as RTLD_LOCAL,
Array as Array,
@@ -19,7 +18,6 @@ from _ctypes import (
alignment as alignment,
byref as byref,
get_errno as get_errno,
pointer as pointer,
resize as resize,
set_errno as set_errno,
sizeof as sizeof,
@@ -27,7 +25,7 @@ from _ctypes import (
from _typeshed import StrPath
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
from types import GenericAlias
from typing import Any, ClassVar, Generic, Literal, TypeVar, type_check_only
from typing import Any, ClassVar, Generic, Literal, TypeVar, overload, type_check_only
from typing_extensions import Self, TypeAlias, deprecated
if sys.platform == "win32":
@@ -36,9 +34,22 @@ if sys.platform == "win32":
if sys.version_info >= (3, 11):
from ctypes._endian import BigEndianUnion as BigEndianUnion, LittleEndianUnion as LittleEndianUnion
_CT = TypeVar("_CT", bound=_CData)
_T = TypeVar("_T", default=Any)
_DLLT = TypeVar("_DLLT", bound=CDLL)
_CT = TypeVar("_CT", bound=_CData)
if sys.version_info >= (3, 14):
@overload
@deprecated("ctypes.POINTER with string")
def POINTER(obj: str) -> type[Any]: ...
@overload
def POINTER(obj: None) -> type[c_void_p]: ...
@overload
def POINTER(obj: type[_CT]) -> type[_Pointer[_CT]]: ...
def pointer(obj: _CT) -> _Pointer[_CT]: ...
else:
from _ctypes import POINTER as POINTER, pointer as pointer
DEFAULT_MODE: int
@@ -148,7 +159,7 @@ c_buffer = create_string_buffer
def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ...
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15")
def SetPointerType(pointer: type[_Pointer[Any]], cls: Any) -> None: ... # noqa: F811
def SetPointerType(pointer: type[_Pointer[Any]], cls: Any) -> None: ...
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to remove
if sys.platform == "win32":