comtypes 1.4.10__zip → 1.4.12__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. {comtypes-1.4.10 → comtypes-1.4.12}/CHANGES.txt +48 -0
  2. {comtypes-1.4.10/comtypes.egg-info → comtypes-1.4.12}/PKG-INFO +4 -3
  3. {comtypes-1.4.10 → comtypes-1.4.12}/README.md +1 -1
  4. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/__init__.py +11 -5
  5. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_comobject.py +29 -31
  6. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_memberspec.py +107 -81
  7. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_meta.py +1 -1
  8. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_npsupport.py +12 -17
  9. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/_cominterface_meta_patcher.py +8 -10
  10. comtypes-1.4.12/comtypes/_post_coinit/activeobj.py +61 -0
  11. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/misc.py +1 -23
  12. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/unknwn.py +33 -26
  13. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_vtbl.py +55 -58
  14. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/automation.py +19 -23
  15. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/__init__.py +2 -1
  16. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_activeobj.py +8 -0
  17. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_code_cache.py +10 -24
  18. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_constants.py +1 -1
  19. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_events.py +92 -54
  20. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_generate.py +1 -3
  21. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/dynamic.py +3 -3
  22. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/lazybind.py +3 -3
  23. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/connectionpoints.py +37 -3
  24. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/errorinfo.py +54 -16
  25. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/hints.pyi +15 -2
  26. comtypes-1.4.12/comtypes/hresult.py +159 -0
  27. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/messageloop.py +15 -13
  28. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/patcher.py +2 -2
  29. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/persist.py +9 -2
  30. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/safearray.py +10 -10
  31. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/__init__.py +5 -37
  32. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/automation.py +2 -2
  33. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/connectionpoints.py +71 -70
  34. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/inprocserver.py +10 -7
  35. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/localserver.py +16 -22
  36. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/register.py +7 -7
  37. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_GUID.py +6 -7
  38. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_agilent.py +1 -1
  39. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_basic.py +6 -3
  40. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_client_dynamic.py +1 -1
  41. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_collections.py +6 -3
  42. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_comobject.py +19 -6
  43. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_comserver.py +32 -4
  44. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_createwrappers.py +1 -1
  45. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dict.py +2 -1
  46. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dispifc_records.py +0 -2
  47. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dispifc_safearrays.py +0 -2
  48. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dispinterface.py +1 -1
  49. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dyndispatch.py +4 -2
  50. comtypes-1.4.12/comtypes/test/test_errorinfo.py +115 -0
  51. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_excel.py +1 -3
  52. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_getactiveobj.py +19 -2
  53. comtypes-1.4.12/comtypes/test/test_hresult.py +87 -0
  54. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_inout_args.py +9 -2
  55. comtypes-1.4.12/comtypes/test/test_messageloop.py +117 -0
  56. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_midl_safearray_create.py +0 -2
  57. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_msscript.py +1 -1
  58. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_npsupport.py +22 -11
  59. comtypes-1.4.12/comtypes/test/test_persist.py +71 -0
  60. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_recordinfo.py +0 -2
  61. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_safearray.py +2 -1
  62. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_server.py +6 -6
  63. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_server_register.py +2 -1
  64. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_storage.py +1 -1
  65. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_stream.py +22 -2
  66. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_typeinfo.py +19 -2
  67. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_urlhistory.py +1 -1
  68. comtypes-1.4.12/comtypes/test/test_util.py +227 -0
  69. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_variant.py +43 -25
  70. comtypes-1.4.12/comtypes/test/test_viewobject.py +78 -0
  71. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_w_getopt.py +4 -4
  72. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_word.py +1 -1
  73. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/codegenerator.py +1 -1
  74. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/comments.py +1 -1
  75. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/heads.py +5 -5
  76. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/helpers.py +7 -7
  77. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/namespaces.py +3 -3
  78. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/typeannotator.py +2 -2
  79. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/tlbparser.py +8 -7
  80. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/typedesc.py +14 -14
  81. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/typedesc_base.py +19 -19
  82. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/typeinfo.py +14 -9
  83. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/util.py +38 -6
  84. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/viewobject.py +29 -5
  85. {comtypes-1.4.10 → comtypes-1.4.12/comtypes.egg-info}/PKG-INFO +4 -3
  86. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes.egg-info/SOURCES.txt +6 -0
  87. {comtypes-1.4.10 → comtypes-1.4.12}/pyproject.toml +13 -7
  88. comtypes-1.4.10/comtypes/hresult.py +0 -81
  89. comtypes-1.4.10/comtypes/test/test_persist.py +0 -38
  90. {comtypes-1.4.10 → comtypes-1.4.12}/LICENSE.txt +0 -0
  91. {comtypes-1.4.10 → comtypes-1.4.12}/MANIFEST.in +0 -0
  92. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/GUID.py +0 -0
  93. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/__init__.py +0 -0
  94. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/bstr.py +0 -0
  95. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/instancemethod.py +0 -0
  96. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_safearray.py +0 -0
  97. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_tlib_version_checker.py +0 -0
  98. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/clear_cache.py +0 -0
  99. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_create.py +0 -0
  100. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_managing.py +0 -0
  101. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/git.py +0 -0
  102. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/logutil.py +0 -0
  103. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/w_getopt.py +0 -0
  104. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/shelllink.py +0 -0
  105. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/stream.py +0 -0
  106. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestComServer.idl +0 -0
  107. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestComServer.py +0 -0
  108. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestComServer.tlb +0 -0
  109. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestDispServer.idl +0 -0
  110. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestDispServer.py +0 -0
  111. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestDispServer.tlb +0 -0
  112. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/__init__.py +0 -0
  113. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/find_memleak.py +0 -0
  114. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/mylib.idl +0 -0
  115. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/mylib.tlb +0 -0
  116. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/mytypelib.idl +0 -0
  117. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/runtests.py +0 -0
  118. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/setup.py +0 -0
  119. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_BSTR.py +0 -0
  120. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_DISPPARAMS.py +0 -0
  121. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_QueryService.py +0 -0
  122. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_avmc.py +0 -0
  123. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_casesensitivity.py +0 -0
  124. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_clear_cache.py +0 -0
  125. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_client.py +0 -0
  126. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_client_regenerate_modules.py +0 -0
  127. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_findgendir.py +0 -0
  128. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_ie.py +0 -0
  129. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_ienum.py +0 -0
  130. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_imfattributes.py +0 -0
  131. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_jscript.js +0 -0
  132. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_monikers.py +0 -0
  133. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_outparam.py +0 -0
  134. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_pump_events.py +0 -0
  135. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_sapi.py +0 -0
  136. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_shelllink.py +0 -0
  137. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_showevents.py +0 -0
  138. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_subinterface.py +0 -0
  139. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_typeannotator.py +0 -0
  140. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_win32com_interop.py +0 -0
  141. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_wmi.py +0 -0
  142. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/urlhist.tlb +0 -0
  143. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/__init__.py +0 -0
  144. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/__init__.py +0 -0
  145. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/modulenamer.py +0 -0
  146. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/packing.py +0 -0
  147. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes.egg-info/dependency_links.txt +0 -0
  148. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes.egg-info/entry_points.txt +0 -0
  149. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes.egg-info/top_level.txt +0 -0
  150. {comtypes-1.4.10 → comtypes-1.4.12}/setup.cfg +0 -0
  151. {comtypes-1.4.10 → comtypes-1.4.12}/setup.py +0 -0
@@ -1,6 +1,54 @@
1
1
  Comtypes CHANGELOG
2
2
  ==================
3
3
 
4
+ Release 1.4.12
5
+ --------------
6
+ * Add support for coverage. By @moi15moi.
7
+ * CI/CD Improvements for runners and the codecov badge. By @junkmd.
8
+ * Add signed 32-bit hexadecimal converters. By @junkmd.
9
+ * Add ``Test_Stat`` to ``test_stream``. By @junkmd.
10
+ * Add client-side ``RegisterActiveObject``. By @junkmd.
11
+ * Remove useless ``object`` inheritance from every class. By @moi15moi.
12
+ * Modernize ``super()`` calls by removing explicit class and instance arguments. By @moi15moi.
13
+ * Eliminate outdated encoding boilerplates. By @moi15moi.
14
+ * Update byte string creation to use ``b""`` instead of ``str.encode("utf-8")``. By @moi15moi.
15
+ * Introduce ``codecov.yml``. By @moi15moi.
16
+ * Migrate exception catches from older aliases to ``OSError``. By @moi15moi.
17
+ * Remove obsolete Python 2 compatibility code in ``test_variant``. By @junkmd.
18
+ * Skip ``test_eval`` in INPROC server tests due to instability. By @junkmd.
19
+ * Adjust structure sizes and alignments for 64-bit Python in ``viewobject.py``. By @junkmd.
20
+ * Add ``test_viewobject``. By @junkmd.
21
+ * Ensure ``test_npsupport`` passes with ``numpy>=2.0.0`` by explicitly setting ``dtype=numpy.int32``. By @junkmd.
22
+ * Add tests for ``DictPropertyBag`` and type hints for ``IPropertyBag``. By @junkmd.
23
+ * Fix ``numpy`` interoperability and enable ``datetime64`` tests. By @junkmd.
24
+ * Revive and correct integer handling logic for ``VARIANT``s when setting values. By @junkmd.
25
+ * Add tests for ``messageloop``. By @junkmd.
26
+ * Revive ``util`` and add comprehensive tests. By @junkmd.
27
+ * Refactor and enhance ``util`` with explicit imports and typing. By @junkmd.
28
+ * Modernize ``npsupport`` by removing the patch for the ``np._typecodes``. By @junkmd.
29
+
30
+ Release 1.4.11
31
+ --------------
32
+ * Improve ``PARAMFLAG_...`` and ``DISPATCH_...`` constants definitions and imports. By @junkmd.
33
+ * Introduce the ``_CDataType`` alias from typeshed. By @junkmd.
34
+ * Replace ``260`` literals/constant definitions with imports from ``ctypes.wintypes.MAX_PATH``. By @junkmd.
35
+ * Replace ``client._code_cache._get_module_filename`` with ``typeinfo.GetModuleFileName``. By @junkmd.
36
+ * Improve ``client._code_cache.SHGetSpecialFolderPath`` definition. By @junkmd.
37
+ * Add type annotations to many modules. By @junkmd.
38
+ * Add constants to many modules. By @junkmd.
39
+ * Improve import block styles to many modules. By @junkmd.
40
+ * Add ``SupportErrorInfoTest`` to ``test_comserver``. By @junkmd.
41
+ * Add ``test_errorinfo``. By @junkmd.
42
+ * Improve the type safety of ``errorinfo.ReportException``. By @junkmd.
43
+ * Change the method of retrieving the values of each field in ``_...MemberSpec`` from unpacking to dot access. By @junkmd.
44
+ * Split ``server.connectionpoints.ConnectionPointImpl._call_sinks``. By @junkmd.
45
+ * Refactor ``create_vtbl_mapping``, ``create_dispimpl`` and ``_encode_idl``. By @junkmd.
46
+ * Add ``test_hresult``. By @junkmd.
47
+ * Add ``Test_Vtbl`` to ``test_comobject.py``. By @junkmd.
48
+ * Delint ``IUnknown_AddRef`` and ``IUnknown_Release``. By @junkmd.
49
+ * Convert ``assertRaises`` usage to context manager for improved readability. By @junkmd.
50
+ * Remove the unused ``PATH`` variable from ``client/_generate.py``. By @moi15moi.
51
+
4
52
  Release 1.4.10
5
53
  --------------
6
54
  * Replace ``GetModuleFileNameA`` with ``GetModuleFileNameW`` to prevent a ``TypeError``. By @junkmd.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: comtypes
3
- Version: 1.4.10
3
+ Version: 1.4.12
4
4
  Summary: Pure Python COM package
5
5
  Home-page: https://github.com/enthought/comtypes
6
6
  Download-URL: https://github.com/enthought/comtypes/releases
@@ -17,6 +17,7 @@ Requires-Python: >=3.8
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE.txt
19
19
  Dynamic: download-url
20
+ Dynamic: license-file
20
21
 
21
22
  # comtypes
22
23
 
@@ -24,7 +25,7 @@ Dynamic: download-url
24
25
  [![PyPI version](https://badge.fury.io/py/comtypes.svg)](https://pypi.org/project/comtypes/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/comtypes)](https://pypi.org/project/comtypes/) [![PyPI - Python Requires](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fpypi.org%2Fpypi%2Fcomtypes%2Fjson&query=info.requires_python&label=Python Requires)](https://pypi.org/project/comtypes/)
25
26
  [![PyPI - License](https://img.shields.io/pypi/l/comtypes)](https://pypi.org/project/comtypes/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/comtypes)](https://pypi.org/project/comtypes/)
26
27
  [![GitHub Repo stars](https://img.shields.io/github/stars/enthought/comtypes?style=social)](https://github.com/enthought/comtypes/stargazers) [![GitHub forks](https://img.shields.io/github/forks/enthought/comtypes?style=social)](https://github.com/enthought/comtypes/network/members) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
27
- [![Tidelift Subscription](https://tidelift.com/badges/package/pypi/comtypes)](https://tidelift.com/subscription/pkg/pypi-comtypes?utm_source=pypi-comtypes&utm_medium=readme)
28
+ [![Tidelift Subscription](https://tidelift.com/badges/package/pypi/comtypes)](https://tidelift.com/subscription/pkg/pypi-comtypes?utm_source=pypi-comtypes&utm_medium=readme) [![Coverage](https://img.shields.io/codecov/c/github/enthought/comtypes)](https://app.codecov.io/github/enthought/comtypes)
28
29
 
29
30
 
30
31
  `comtypes` is a lightweight pure Python [COM](https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal) package based on the [`ctypes`](https://docs.python.org/library/ctypes.html) foreign function interface library.
@@ -4,7 +4,7 @@
4
4
  [![PyPI version](https://badge.fury.io/py/comtypes.svg)](https://pypi.org/project/comtypes/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/comtypes)](https://pypi.org/project/comtypes/) [![PyPI - Python Requires](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fpypi.org%2Fpypi%2Fcomtypes%2Fjson&query=info.requires_python&label=Python Requires)](https://pypi.org/project/comtypes/)
5
5
  [![PyPI - License](https://img.shields.io/pypi/l/comtypes)](https://pypi.org/project/comtypes/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/comtypes)](https://pypi.org/project/comtypes/)
6
6
  [![GitHub Repo stars](https://img.shields.io/github/stars/enthought/comtypes?style=social)](https://github.com/enthought/comtypes/stargazers) [![GitHub forks](https://img.shields.io/github/forks/enthought/comtypes?style=social)](https://github.com/enthought/comtypes/network/members) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
7
- [![Tidelift Subscription](https://tidelift.com/badges/package/pypi/comtypes)](https://tidelift.com/subscription/pkg/pypi-comtypes?utm_source=pypi-comtypes&utm_medium=readme)
7
+ [![Tidelift Subscription](https://tidelift.com/badges/package/pypi/comtypes)](https://tidelift.com/subscription/pkg/pypi-comtypes?utm_source=pypi-comtypes&utm_medium=readme) [![Coverage](https://img.shields.io/codecov/c/github/enthought/comtypes)](https://app.codecov.io/github/enthought/comtypes)
8
8
 
9
9
 
10
10
  `comtypes` is a lightweight pure Python [COM](https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal) package based on the [`ctypes`](https://docs.python.org/library/ctypes.html) foreign function interface library.
@@ -1,5 +1,5 @@
1
1
  # comtypes version numbers follow semver (http://semver.org/) and PEP 440
2
- __version__ = "1.4.10"
2
+ __version__ = "1.4.12"
3
3
 
4
4
  try:
5
5
  from _ctypes import COMError # noqa
@@ -26,7 +26,7 @@ import sys
26
26
  from ctypes import * # noqa # type: ignore
27
27
  from ctypes import HRESULT, OleDLL, WinDLL, _SimpleCData, c_int, c_ulong
28
28
  from ctypes.wintypes import DWORD, LPVOID
29
- from typing import TYPE_CHECKING
29
+ from typing import TYPE_CHECKING, Dict, Type
30
30
 
31
31
  if TYPE_CHECKING:
32
32
  from ctypes import _CData # only in `typeshed`, private in runtime
@@ -172,10 +172,10 @@ def CoUninitialize():
172
172
  # global registries.
173
173
 
174
174
  # allows to find interface classes by guid strings (iid)
175
- com_interface_registry = {}
175
+ com_interface_registry: Dict[str, Type["IUnknown"]] = {}
176
176
 
177
177
  # allows to find coclasses by guid strings (clsid)
178
- com_coclass_registry = {}
178
+ com_coclass_registry: Dict[str, Type["CoClass"]] = {}
179
179
 
180
180
 
181
181
  ################################################################
@@ -213,12 +213,18 @@ from comtypes._post_coinit.misc import IPersist, IServiceProvider # noqa
213
213
 
214
214
 
215
215
  from comtypes._post_coinit.instancemethod import instancemethod # noqa
216
+ from comtypes._post_coinit.activeobj import ( # noqa
217
+ ACTIVEOBJECT_STRONG,
218
+ ACTIVEOBJECT_WEAK,
219
+ GetActiveObject,
220
+ RegisterActiveObject,
221
+ RevokeActiveObject,
222
+ )
216
223
  from comtypes._post_coinit.misc import ( # noqa
217
224
  _is_object,
218
225
  CoGetObject,
219
226
  CoCreateInstance,
220
227
  CoGetClassObject,
221
- GetActiveObject,
222
228
  MULTI_QI,
223
229
  _COAUTHIDENTITY,
224
230
  COAUTHIDENTITY,
@@ -5,7 +5,6 @@ from ctypes import (
5
5
  POINTER,
6
6
  FormatError,
7
7
  OleDLL,
8
- Structure,
9
8
  WinDLL,
10
9
  byref,
11
10
  c_long,
@@ -29,11 +28,21 @@ from typing import (
29
28
  )
30
29
  from typing import Union as _UnionT
31
30
 
31
+ import comtypes
32
32
  from comtypes import GUID, IPersist, IUnknown, _CoUninitialize, hresult
33
+ from comtypes._memberspec import DISPATCH_METHOD as DISPATCH_METHOD
34
+ from comtypes._memberspec import DISPATCH_PROPERTYGET as DISPATCH_PROPERTYGET
35
+ from comtypes._memberspec import DISPATCH_PROPERTYPUT as DISPATCH_PROPERTYPUT
36
+ from comtypes._memberspec import DISPATCH_PROPERTYPUTREF as DISPATCH_PROPERTYPUTREF
33
37
  from comtypes._vtbl import _MethodFinder, create_dispimpl, create_vtbl_mapping
34
38
  from comtypes.automation import DISPID, DISPPARAMS, EXCEPINFO, VARIANT
35
39
  from comtypes.errorinfo import ISupportErrorInfo
36
- from comtypes.typeinfo import IProvideClassInfo, IProvideClassInfo2, ITypeInfo
40
+ from comtypes.typeinfo import (
41
+ GUIDKIND_DEFAULT_SOURCE_DISP_IID,
42
+ IProvideClassInfo,
43
+ IProvideClassInfo2,
44
+ ITypeInfo,
45
+ )
37
46
 
38
47
  if TYPE_CHECKING:
39
48
  from ctypes import _CArgObject, _Pointer
@@ -46,11 +55,6 @@ _debug = logger.debug
46
55
  ################################################################
47
56
  # COM object implementation
48
57
 
49
- # so we don't have to import comtypes.automation
50
- DISPATCH_METHOD = 1
51
- DISPATCH_PROPERTYGET = 2
52
- DISPATCH_PROPERTYPUT = 4
53
- DISPATCH_PROPERTYPUTREF = 8
54
58
 
55
59
  ################################################################
56
60
 
@@ -140,7 +144,7 @@ _PostQuitMessage.argtypes = [INT]
140
144
  _PostQuitMessage.restype = None
141
145
 
142
146
 
143
- class LocalServer(object):
147
+ class LocalServer:
144
148
  _queue: Optional[queue.Queue] = None
145
149
 
146
150
  def run(self, classobjects: Sequence["hints.localserver.ClassFactory"]) -> None:
@@ -182,7 +186,7 @@ class LocalServer(object):
182
186
  _PostQuitMessage(0)
183
187
 
184
188
 
185
- class InprocServer(object):
189
+ class InprocServer:
186
190
  def __init__(self) -> None:
187
191
  self.locks = c_long(0)
188
192
 
@@ -203,25 +207,25 @@ class InprocServer(object):
203
207
  _T_IUnknown = TypeVar("_T_IUnknown", bound=IUnknown)
204
208
 
205
209
 
206
- class COMObject(object):
210
+ class COMObject:
207
211
  _com_interfaces_: ClassVar[List[Type[IUnknown]]]
208
212
  _outgoing_interfaces_: ClassVar[List[Type["hints.IDispatch"]]]
209
213
  _instances_: ClassVar[Dict["COMObject", None]] = {}
210
214
  _reg_clsid_: ClassVar[GUID]
211
215
  _reg_typelib_: ClassVar[Tuple[str, int, int]]
212
216
  __typelib: "hints.ITypeLib"
213
- _com_pointers_: Dict[GUID, "_Pointer[_Pointer[Structure]]"]
214
- _dispimpl_: Dict[Tuple[int, int], Callable[..., Any]]
217
+ _com_pointers_: Dict[GUID, "hints.LP_LP_Vtbl"]
218
+ _dispimpl_: Dict[Tuple[comtypes.dispid, int], Callable[..., Any]]
215
219
 
216
- def __new__(cls, *args, **kw):
217
- self = super(COMObject, cls).__new__(cls)
220
+ def __new__(cls, *args: Any, **kw: Any) -> "hints.Self":
221
+ self = super().__new__(cls)
218
222
  if isinstance(self, c_void_p):
219
223
  # We build the VTables only for direct instances of
220
224
  # CoClass, not for POINTERs to CoClass.
221
- return self
225
+ return self # type: ignore
222
226
  if hasattr(self, "_com_interfaces_"):
223
227
  self.__prepare_comobject()
224
- return self
228
+ return self # type: ignore
225
229
 
226
230
  def __prepare_comobject(self) -> None:
227
231
  # When a CoClass instance is created, COM pointers to all
@@ -326,10 +330,10 @@ class COMObject(object):
326
330
  def IUnknown_AddRef(
327
331
  self,
328
332
  this: Any,
329
- __InterlockedIncrement: Callable[[c_long], int] = _InterlockedIncrement,
333
+ _increment: Callable[[c_long], int] = _InterlockedIncrement,
330
334
  _debug=_debug,
331
335
  ) -> int:
332
- result = __InterlockedIncrement(self._refcnt)
336
+ result = _increment(self._refcnt)
333
337
  if result == 1:
334
338
  self.__keep__(self)
335
339
  _debug("%r.AddRef() -> %s", self, result)
@@ -343,14 +347,14 @@ class COMObject(object):
343
347
  def IUnknown_Release(
344
348
  self,
345
349
  this: Any,
346
- __InterlockedDecrement: Callable[[c_long], int] = _InterlockedDecrement,
350
+ _decrement: Callable[[c_long], int] = _InterlockedDecrement,
347
351
  _debug=_debug,
348
352
  ) -> int:
349
353
  # If this is called at COM shutdown, _InterlockedDecrement()
350
354
  # must still be available, although module level variables may
351
355
  # have been deleted already - so we supply it as default
352
356
  # argument.
353
- result = __InterlockedDecrement(self._refcnt)
357
+ result = _decrement(self._refcnt)
354
358
  _debug("%r.Release() -> %s", self, result)
355
359
  if result == 0:
356
360
  self._final_release_()
@@ -410,16 +414,15 @@ class COMObject(object):
410
414
  try:
411
415
  self.__typelib
412
416
  except AttributeError:
413
- raise WindowsError(hresult.E_NOTIMPL)
417
+ raise OSError(hresult.E_NOTIMPL)
414
418
  return self.__typelib.GetTypeInfoOfGuid(self._reg_clsid_)
415
419
 
416
420
  ################################################################
417
421
  # IProvideClassInfo2::GetGUID implementation
418
422
 
419
423
  def IProvideClassInfo2_GetGUID(self, dwGuidKind: int) -> GUID:
420
- # GUIDKIND_DEFAULT_SOURCE_DISP_IID = 1
421
- if dwGuidKind != 1:
422
- raise WindowsError(hresult.E_INVALIDARG)
424
+ if dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID:
425
+ raise OSError(hresult.E_INVALIDARG)
423
426
  return self._outgoing_interfaces_[0]._iid_
424
427
 
425
428
  ################################################################
@@ -516,10 +519,7 @@ class COMObject(object):
516
519
  #
517
520
  params = pDispParams[0]
518
521
 
519
- if wFlags & (4 | 8):
520
- # DISPATCH_PROPERTYPUT
521
- # DISPATCH_PROPERTYPUTREF
522
- #
522
+ if wFlags & (DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYPUTREF):
523
523
  # How are the parameters unpacked for propertyput
524
524
  # operations with additional parameters? Can propput
525
525
  # have additional args?
@@ -530,9 +530,7 @@ class COMObject(object):
530
530
  # DISPATCH_PROPERTYPUTREF is specified.
531
531
  return mth(this, *args)
532
532
 
533
- else:
534
- # DISPATCH_METHOD
535
- # DISPATCH_PROPERTYGET
533
+ else: # wFlags & (DISPATCH_METHOD | DISPATCH_PROPERTYGET)
536
534
  # the positions of named arguments
537
535
  #
538
536
  # 2to3 has problems to translate 'range(...)[::-1]'