Skip to content

Commit

Permalink
fix _ctypes.CFuncPtr constructor args (#10154)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
junkmd authored May 7, 2023
1 parent 03e3955 commit 1d69fb3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions stdlib/_ctypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1d69fb3

Please sign in to comment.