-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
fix CoCreateInstance
type annotation
#386
Comments
The type hinting related enhancements related to #327 are moving toward inline annotations(not comments), and it is planned to develop on a branch that is based on Python3-only support. I will assign this issue to myself to work on this to prevent a new branch from being created from |
I believe that all COM interfaces have IUnknown as a base class. So if you are type hinting the return value type hint it as IUnknown. |
Line 780 in 0f3cf2b
And this "serve as the parameters for generic function definitions". # they are examples of the type analyzer behavior. In runtime, they are not available.
a = CoCreateInstance(GUID(), IUnknown) # `a` is recognized as `IUnknown` instance by type analyzer.
b = CoCreateInstance(GUID(), IPersist) # `b` is recognized as `IPersist` instance by type analyzer.
c = CoCreateInstance(GUID(), IServiceProvider) # `c` is recognized as `IServiceProvider` instance by type analyzer. |
CoCreateInstanceEx
is annotated with a return value based on the type variable passed as an argument.comtypes/comtypes/__init__.py
Lines 1095 to 1099 in 0f3cf2b
However,
CoCreateInstance
does not.comtypes/comtypes/__init__.py
Lines 919 to 922 in 0f3cf2b
Please fix as follows.
The text was updated successfully, but these errors were encountered: