fix _ctypes.CFuncPtr constructor args (#10154)

* add a conditional branch for Windows only

* fix argname spelling
`vtlb_index` -> `vtbl_index`

* add an overload
for the case where no arguments are passed to the constructor

* mark all of the arguments as positional-only
This commit is contained in:
Jun Komoda
2023-05-07 12:04:16 +09:00
committed by GitHub
parent 03e3955037
commit 1d69fb3675

View File

@@ -102,13 +102,19 @@ class CFuncPtr(_PointerLike, _CData):
errcheck: _ECT
_flags_: ClassVar[int] # Abstract attribute that must be defined on subclasses
@overload
def __init__(self, address: int) -> None: ...
def __init__(self) -> None: ...
@overload
def __init__(self, callable: Callable[..., Any]) -> None: ...
def __init__(self, __address: int) -> None: ...
@overload
def __init__(self, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] = ...) -> None: ...
def __init__(self, __callable: Callable[..., Any]) -> None: ...
@overload
def __init__(self, vtlb_index: int, name: str, paramflags: tuple[_PF, ...] = ..., iid: _Pointer[c_int] = ...) -> None: ...
def __init__(self, __func_spec: tuple[str | int, CDLL], __paramflags: tuple[_PF, ...] = ...) -> None: ...
if sys.platform == "win32":
@overload
def __init__(
self, __vtbl_index: int, __name: str, __paramflags: tuple[_PF, ...] = ..., __iid: _Pointer[c_int] = ...
) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
class _CField: