Skip to content

Correcting type hint for CreateObject #470

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

Merged
merged 1 commit into from
Jan 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions comtypes/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,13 @@ def GetClassObject(progid, clsctx=None, pServerInfo=None, interface=None):


@overload
def CreateObject(progid: _UnionT[str, CoClass, GUID]) -> Any:
def CreateObject(progid: _UnionT[str, Type[CoClass], GUID]) -> Any:
...


@overload
def CreateObject(
progid: _UnionT[str, CoClass, GUID],
progid: _UnionT[str, Type[CoClass], GUID],
clsctx: Optional[int] = None,
machine: Optional[str] = None,
interface: Optional[Type[_T_IUnknown]] = None,
Expand All @@ -240,7 +240,7 @@ def CreateObject(


def CreateObject(
progid: _UnionT[str, CoClass, GUID], # which object to create
progid: _UnionT[str, Type[CoClass], GUID], # which object to create
clsctx: Optional[int] = None, # how to create the object
machine: Optional[str] = None, # where to create the object
interface: Optional[Type[IUnknown]] = None, # the interface we want
Expand Down Expand Up @@ -289,7 +289,7 @@ def CreateObject(
pServerInfo,
)
if machine is not None and pServerInfo is not None:
msg = "You can notset both the machine name and server info."
msg = "You cannot set both the machine name and server info."
raise ValueError(msg)
obj = comtypes.CoCreateInstanceEx(
clsid,
Expand Down