-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ctypes: constructor of _FuncPointer can accept None to paramflags and Structure to iid in runtime #9251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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, address: int) -> _FuncPointer
- comtypes/_memberspec.py:357: note: def __init__(self, callable: 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, 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: 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, address: int) -> _FuncPointer
- comtypes/_memberspec.py:358: note: def __init__(self, callable: 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, vtlb_index: int, name: str, paramflags: Tuple[Union[Tuple[int], Tuple[int, str], Tuple[int, str, Any]], ...] = ..., iid: _Pointer[c_int] = ...) -> _FuncPointer
|
@@ -247,7 +247,7 @@ class Tag(PageElement): | |||
name: str | None = ..., | |||
namespace: str | None = ..., | |||
prefix: str | None = ..., | |||
attrs: dict[str, str] | None = ..., | |||
attrs: dict[str, Any] | None = ..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave this change for another PR.
The ctypes code can be hard to follow, but I think there's more we can do here to improve things. The implementation of the code being changed here is at https://github.com/python/cpython/blob/8f18ac04d32515eab841172c956a8cb14bcee9c3/Modules/_ctypes/_ctypes.c#L3627.
|
thank you @JelleZijlstra for these information. However, i did not understand much from these. |
fixes #8968