Repository navigation
fix _ctypes.CFuncPtr constructor args - #10154
Merged
Merged
Conversation
`vtlb_index` -> `vtbl_index`
for the case where no arguments are passed to the constructor
JelleZijlstra
approved these changes
May 7, 2023
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: comtypes (https://github.com/enthought/comtypes)
+ comtypes/_memberspec.py:357: note: def __init__(self) -> _FuncPointer
- comtypes/_memberspec.py:357: note: def __init__(self, address: int) -> _FuncPointer
+ comtypes/_memberspec.py:357: note: def __init__(self, int, /) -> _FuncPointer
- comtypes/_memberspec.py:357: note: def __init__(self, callable: Callable[..., Any]) -> _FuncPointer
+ comtypes/_memberspec.py:357: note: def __init__(self, Callable[..., Any], /) -> _FuncPointer
- comtypes/_memberspec.py:357: note: def __init__(self, func_spec: Tuple[Union[str, int], CDLL], paramflags: Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ...) -> _FuncPointer
+ comtypes/_memberspec.py:357: note: def __init__(self, Tuple[Union[str, int], CDLL], Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., /) -> _FuncPointer
- comtypes/_memberspec.py:357: note: def __init__(self, vtlb_index: int, name: str, paramflags: Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., iid: _Pointer[c_int] = ...) -> _FuncPointer
+ comtypes/_memberspec.py:357: note: def __init__(self, int, str, Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., _Pointer[c_int] = ..., /) -> _FuncPointer
+ comtypes/_memberspec.py:358: note: def __init__(self) -> _FuncPointer
- comtypes/_memberspec.py:358: note: def __init__(self, address: int) -> _FuncPointer
+ comtypes/_memberspec.py:358: note: def __init__(self, int, /) -> _FuncPointer
- comtypes/_memberspec.py:358: note: def __init__(self, callable: Callable[..., Any]) -> _FuncPointer
+ comtypes/_memberspec.py:358: note: def __init__(self, Callable[..., Any], /) -> _FuncPointer
- comtypes/_memberspec.py:358: note: def __init__(self, func_spec: Tuple[Union[str, int], CDLL], paramflags: Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ...) -> _FuncPointer
+ comtypes/_memberspec.py:358: note: def __init__(self, Tuple[Union[str, int], CDLL], Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., /) -> _FuncPointer
- comtypes/_memberspec.py:358: note: def __init__(self, vtlb_index: int, name: str, paramflags: Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., iid: _Pointer[c_int] = ...) -> _FuncPointer
+ comtypes/_memberspec.py:358: note: def __init__(self, int, str, Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., _Pointer[c_int] = ..., /) -> _FuncPointer
|
bkeryan
added a commit
to ni/nidaqmx-python
that referenced
this pull request
Jun 5, 2023
typeshed was missing the no-arguments constructor for `_ctypes.CFuncPtr` until very recently. python/typeshed#10154 generated\nidaqmx\_library_interpreter.py:4414: error: All overload variants of "_FuncPointer" require at least one argument [call-overload] generated\nidaqmx\_library_interpreter.py:4414: note: Possible overload variants: generated\nidaqmx\_library_interpreter.py:4414: note: def _FuncPointer(self, address: int) -> _FuncPointer generated\nidaqmx\_library_interpreter.py:4414: note: def _FuncPointer(self, callable: Callable[..., Any]) -> _FuncPointer generated\nidaqmx\_library_interpreter.py:4414: note: def _FuncPointer(self, func_spec: Tuple[Union[str, int], CDLL], paramflags: Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ...) -> _FuncPointer generated\nidaqmx\_library_interpreter.py:4414: note: def _FuncPointer(self, vtlb_index: int, name: str, paramflags: Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., iid: _Pointer[c_int] = ...) -> _FuncPointer Signed-off-by: Brad Keryan <brad.keryan@ni.com>
bkeryan
added a commit
to ni/nidaqmx-python
that referenced
this pull request
Jun 6, 2023
typeshed was missing the no-arguments constructor for `_ctypes.CFuncPtr` until very recently. python/typeshed#10154 generated\nidaqmx\_library_interpreter.py:4414: error: All overload variants of "_FuncPointer" require at least one argument [call-overload] generated\nidaqmx\_library_interpreter.py:4414: note: Possible overload variants: generated\nidaqmx\_library_interpreter.py:4414: note: def _FuncPointer(self, address: int) -> _FuncPointer generated\nidaqmx\_library_interpreter.py:4414: note: def _FuncPointer(self, callable: Callable[..., Any]) -> _FuncPointer generated\nidaqmx\_library_interpreter.py:4414: note: def _FuncPointer(self, func_spec: Tuple[Union[str, int], CDLL], paramflags: Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ...) -> _FuncPointer generated\nidaqmx\_library_interpreter.py:4414: note: def _FuncPointer(self, vtlb_index: int, name: str, paramflags: Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., iid: _Pointer[c_int] = ...) -> _FuncPointer Signed-off-by: Brad Keryan <brad.keryan@ni.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Quoting from #9251 (comment)
-> 35b1273
-> e36b517
-> 9d7beb0, e86ea2e
I fixed them.
_FuncPointercan acceptNonetoparamflagsandStructuretoiidin runtime. #8968.