Skip to content

Commit 5fbe2d4

Browse files
authored
Move the module defining the GUID symbol under the _post_coinit subpackage. (#653)
* `git mv comtypes/GUID.py comtypes/_post_coinit/guid.py` * Modify the import sections to reflect the definition changes. * Avoid runtime errors caused by undefined references by changing the type annotation to a string literal.
1 parent e62a7e9 commit 5fbe2d4

5 files changed

Lines changed: 7 additions & 6 deletions

File tree

comtypes/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
else:
3636
_CData = _SimpleCData.__mro__[:-1][-1]
3737

38-
from comtypes.GUID import GUID
3938
from comtypes import patcher # noqa
4039
from comtypes._npsupport import interop as npsupport # noqa
4140
from comtypes._tlib_version_checker import _check_version # noqa
@@ -73,8 +72,6 @@ class ReturnHRESULT(Exception):
7372
# class IDLWarning(UserWarning):
7473
# "Warn about questionable type information"
7574

76-
_GUID = GUID
77-
IID = GUID
7875
DWORD = c_ulong
7976

8077
wireHWND = c_ulong
@@ -182,7 +179,10 @@ def CoUninitialize():
182179
################################################################
183180

184181
from comtypes._post_coinit.bstr import BSTR # noqa
182+
from comtypes._post_coinit.guid import GUID
185183

184+
_GUID = GUID
185+
IID = GUID
186186

187187
################################################################
188188
# IPersist is a trivial interface, which allows to ask an object about

comtypes/_memberspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def to_propputref_keys(self, m: _DispMemberSpec) -> Tuple[str, _DocType, int]:
360360

361361

362362
class ComMemberGenerator(object):
363-
def __init__(self, cls_name: str, vtbl_offset: int, iid: comtypes.GUID) -> None:
363+
def __init__(self, cls_name: str, vtbl_offset: int, iid: "comtypes.GUID") -> None:
364364
self._vtbl_offset = vtbl_offset
365365
self._iid = iid
366366
self._props = ComPropertyGenerator(cls_name)

comtypes/_post_coinit/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
if TYPE_CHECKING:
1616
from comtypes import hints as hints # noqa # type: ignore
1717

18-
from comtypes import GUID
1918
from comtypes._idl_stuff import COMMETHOD # noqa
2019
from comtypes import CLSCTX_SERVER, CLSCTX_LOCAL_SERVER, CLSCTX_REMOTE_SERVER
2120
from comtypes import _ole32, oledll, DWORD
2221
from comtypes._post_coinit.unknwn import IUnknown
22+
from comtypes._post_coinit.guid import GUID
2323

2424

2525
def _is_object(obj):

comtypes/_post_coinit/unknwn.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
from typing import Optional
88
from typing import List, Type
99

10-
from comtypes import GUID, _ole32_nohresult, com_interface_registry
10+
from comtypes import _ole32_nohresult, com_interface_registry
1111
from comtypes._idl_stuff import STDMETHOD
1212
from comtypes._memberspec import ComMemberGenerator, DispMemberGenerator
1313
from comtypes._memberspec import _ComMemberSpec, _DispMemberSpec
1414
from comtypes._post_coinit import _cominterface_meta_patcher as _meta_patch
15+
from comtypes._post_coinit.guid import GUID
1516
from comtypes._py_instance_method import instancemethod
1617

1718
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)