-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
The constructor of _FuncPointer
can accept None
to paramflags
and Structure
to iid
in runtime.
#8968
Comments
hi, |
Ok, I'll leave it for you. I also noticed that |
i analysed the issue and have few questions to ask.
I am new a new contributor to this repository and need your help to understand the functional thought behind the changes. thanks |
see this code snippet. This is available in runtime. So I think that _PF: TypeAlias = _UnionT[tuple[int], tuple[int, str | None], tuple[int, str | None, Any]]
class _FuncPointer(_PointerLike, _CData):
...
@overload
def __init__(self, vtlb_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | None = ...) -> None: ... |
This part is closely tied to the C implementation. I posted this issue because it doesn't make sense to me that the code that runs at runtime has an error in the type checker. I haven't read that much of the C implementation code and wanted to get the views of anyone familiar with the |
@junkmd however we have look for documentation also.please advise |
I have read the C implementation. I am not familiar with C, but from the conditional branching of the overloading process, I can interpret it to accept |
@junkmd here, PyCFuncPtrObject* is converting the returrning pyobject to ctype and storing to self.then setting the each value, including iid in ctype. and finally. converting the self to pyObject and return.. from these inference, you are deriving that iid should be cData or None. am i right? thanks |
Yes, I think you're right. |
thank you.. |
i did the changes and below issue i got while performing pulling request..
|
the type hints of paramflag is different from _functPointer overload in comtypes |
I think the following typeshed/stdlib/ctypes/__init__.pyi Line 89 in dc7fdc6
_PF: TypeAlias = _UnionT[tuple[int], tuple[int, str | None], tuple[int, str | None, Any]] |
Optional[Tuple[Union[Tuple[int, Optional[str]], Tuple[int, Optional[str], Any]], ...]] here 2 arguments are given however in _PF 3 arguments..though union wise it looks same. Will it not create any problem? Thanks |
The The ParamFlagType: TypeAlias = _UnionT[tuple[int, str | None], tuple[int, str | None, Any]] This is contained in The purpose of this change is to ensure that type checking does not cause an error if it is safe to pass it as an argument at runtime. |
I think this issue should be addressed after the class definitions have been moved to |
The definitions of these constructors have been moved to This issue has also not moved for about 6 months. Thank you for your cooperation. |
I close this because #10155 is merged. Thank you. |
Thank you for all your work on ctypes stubs, @junkmd! |
typeshed/stdlib/ctypes/__init__.pyi
Lines 115 to 117 in dc7fdc6
typeshed/stdlib/ctypes/__init__.pyi
Lines 91 to 103 in dc7fdc6
This is simplified my project code.
And it can run in Py2.7 and Py3.3-3.10.
Probably this is a false-positive.
I think that line 102 of
ctypes/__init__.pyi
will be fixed as below.Any opinions would be appreciated.
The text was updated successfully, but these errors were encountered: