Skip to content

update constructor args of the CFuncPtr to expand acceptable types - #10155

Merged
JelleZijlstra merged 4 commits into
python:mainfrom
junkmd:update_CFuncPtr_ctor_args_types
May 7, 2023
Merged

JelleZijlstra merged 4 commits into
python:mainfrom
junkmd:update_CFuncPtr_ctor_args_types

Conversation

@junkmd

@junkmd junkmd commented May 7, 2023

Copy link
Copy Markdown
Contributor

Please see #8968

@github-actions

github-actions Bot commented May 7, 2023

Copy link
Copy Markdown
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: error: No overload variant of "_FuncPointer" matches argument types "int", "str", "None", "Optional[GUID]"  [call-overload]
- comtypes/_memberspec.py:357: note: Possible overload variants:
- comtypes/_memberspec.py:357: note:     def __init__(self) -> _FuncPointer
- comtypes/_memberspec.py:357: note:     def __init__(self, int, /) -> _FuncPointer
- comtypes/_memberspec.py:357: note:     def __init__(self, Callable[..., 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, int, str, Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., _Pointer[c_int] = ..., /) -> _FuncPointer
- comtypes/_memberspec.py:358: error: No overload variant of "_FuncPointer" matches argument types "int", "str", "Optional[Tuple[Union[Tuple[int, Optional[str]], Tuple[int, Optional[str], Any]], ...]]", "Optional[GUID]"  [call-overload]
- comtypes/_memberspec.py:358: note: Possible overload variants:
- comtypes/_memberspec.py:358: note:     def __init__(self) -> _FuncPointer
- comtypes/_memberspec.py:358: note:     def __init__(self, int, /) -> _FuncPointer
- comtypes/_memberspec.py:358: note:     def __init__(self, Callable[..., 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, int, str, Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., _Pointer[c_int] = ..., /) -> _FuncPointer

@junkmd

junkmd commented May 7, 2023

Copy link
Copy Markdown
Contributor Author

Diff from mypy_primer, showing the effect of this PR on open source code:

comtypes (https://github.com/enthought/comtypes)
- comtypes/_memberspec.py:357: error: No overload variant of "_FuncPointer" matches argument types "int", "str", "None", "Optional[GUID]"  [call-overload]
- comtypes/_memberspec.py:357: note: Possible overload variants:
- comtypes/_memberspec.py:357: note:     def __init__(self) -> _FuncPointer
- comtypes/_memberspec.py:357: note:     def __init__(self, int, /) -> _FuncPointer
- comtypes/_memberspec.py:357: note:     def __init__(self, Callable[..., 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, int, str, Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., _Pointer[c_int] = ..., /) -> _FuncPointer
- comtypes/_memberspec.py:358: error: No overload variant of "_FuncPointer" matches argument types "int", "str", "Optional[Tuple[Union[Tuple[int, Optional[str]], Tuple[int, Optional[str], Any]], ...]]", "Optional[GUID]"  [call-overload]
- comtypes/_memberspec.py:358: note: Possible overload variants:
- comtypes/_memberspec.py:358: note:     def __init__(self) -> _FuncPointer
- comtypes/_memberspec.py:358: note:     def __init__(self, int, /) -> _FuncPointer
- comtypes/_memberspec.py:358: note:     def __init__(self, Callable[..., 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, int, str, Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., _Pointer[c_int] = ..., /) -> _FuncPointer

I recognize this result as the elimination of false positives in the comtypes.

@JelleZijlstra
JelleZijlstra merged commit 9457de3 into python:main May 7, 2023
@junkmd
junkmd deleted the update_CFuncPtr_ctor_args_types branch May 7, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants