move and rename from ctypes._FuncPointer to _ctypes.CFuncPtr (#10140)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Jun KomodaandAlex Waygood authored and GitHub committed 2023-05-06 10:17:34 -07:00
1 parent 853d01d55e
commit a6ecf564b5
3 files changed
+25 -22

No files matched your search

+21 -3
View File
@@ -1,9 +1,9 @@
import sys
from _typeshed import ReadableBuffer, WriteableBuffer
from abc import abstractmethod
from collections.abc import Iterable, Iterator, Mapping, Sequence
from ctypes import CDLL
from typing import Any, Generic, TypeVar, overload
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from ctypes import CDLL, c_int
from typing import Any, ClassVar, Generic, TypeVar, overload
from typing_extensions import Self, TypeAlias
if sys.version_info >= (3, 9):
@@ -93,6 +93,24 @@ class _CArgObject: ...
def byref(obj: _CData, offset: int = ...) -> _CArgObject: ...
_ECT: TypeAlias = Callable[[type[_CData] | None, CFuncPtr, tuple[_CData, ...]], _CData]
_PF: TypeAlias = tuple[int] | tuple[int, str] | tuple[int, str, Any]
class CFuncPtr(_PointerLike, _CData):
restype: type[_CData] | Callable[[int], Any] | None
argtypes: Sequence[type[_CData]]
errcheck: _ECT
_flags_: ClassVar[int] # Abstract attribute that must be defined on subclasses
@overload
def __init__(self, address: int) -> None: ...
@overload
def __init__(self, callable: Callable[..., Any]) -> None: ...
@overload
def __init__(self, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] = ...) -> None: ...
@overload
def __init__(self, vtlb_index: int, name: str, paramflags: tuple[_PF, ...] = ..., iid: _Pointer[c_int] = ...) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
class _CField:
offset: int
size: int