comtypes 1.4.16__tar.gz → 1.5.0__tar.gz
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.
- {comtypes-1.4.16 → comtypes-1.5.0}/CHANGES.txt +37 -0
- {comtypes-1.4.16/comtypes.egg-info → comtypes-1.5.0}/PKG-INFO +3 -7
- {comtypes-1.4.16 → comtypes-1.5.0}/README.md +2 -6
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/__init__.py +33 -46
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_memberspec.py +116 -14
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_post_coinit/misc.py +8 -7
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_safearray.py +32 -1
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/automation.py +275 -19
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/_activeobj.py +17 -3
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/_create.py +47 -11
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/_events.py +13 -1
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/git.py +15 -26
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/hints.pyi +29 -16
- comtypes-1.5.0/comtypes/logutil.py +28 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/messageloop.py +21 -3
- comtypes-1.5.0/comtypes/py.typed +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/safearray.py +72 -7
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_basic.py +8 -11
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_client.py +21 -19
- comtypes-1.5.0/comtypes/test/test_compatibility_tlbparser_VT_I1_assignment.py +566 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_comserver.py +1 -1
- comtypes-1.5.0/comtypes/test/test_cpp_safearray.py +178 -0
- comtypes-1.5.0/comtypes/test/test_eventinterface.py +155 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_excel.py +9 -0
- comtypes-1.5.0/comtypes/test/test_fixed_point_marshaling.py +456 -0
- comtypes-1.5.0/comtypes/test/test_fixed_point_numbers.py +571 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_git.py +7 -9
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_logutil.py +1 -15
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_midl_safearray_create.py +26 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_npsupport.py +87 -2
- comtypes-1.5.0/comtypes/test/test_packing.py +45 -0
- comtypes-1.5.0/comtypes/test/test_record_safearray_bstr.py +480 -0
- comtypes-1.5.0/comtypes/test/test_record_safearray_value.py +403 -0
- comtypes-1.5.0/comtypes/test/test_string_safearray_inside_variant.py +138 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_typeannotator.py +20 -14
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_variant.py +122 -3
- comtypes-1.5.0/comtypes/test/test_variant_error.py +68 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/codegenerator/codegenerator.py +109 -88
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/codegenerator/heads.py +11 -46
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/codegenerator/helpers.py +8 -15
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/codegenerator/namespaces.py +37 -13
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/codegenerator/packing.py +8 -7
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/codegenerator/typeannotator.py +46 -15
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/tlbparser.py +109 -45
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/typedesc.py +33 -7
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/typedesc_base.py +25 -19
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/util.py +11 -2
- {comtypes-1.4.16 → comtypes-1.5.0/comtypes.egg-info}/PKG-INFO +3 -7
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes.egg-info/SOURCES.txt +10 -1
- {comtypes-1.4.16 → comtypes-1.5.0}/pyproject.toml +1 -4
- comtypes-1.4.16/comtypes/logutil.py +0 -83
- comtypes-1.4.16/comtypes/test/test_eventinterface.py +0 -150
- comtypes-1.4.16/comtypes/tools/codegenerator/comments.py +0 -79
- {comtypes-1.4.16 → comtypes-1.5.0}/LICENSE.txt +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/MANIFEST.in +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/GUID.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_comobject.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_meta.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_npsupport.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_post_coinit/__init__.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_post_coinit/_cominterface_meta_patcher.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_post_coinit/activeobj.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_post_coinit/bstr.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_post_coinit/instancemethod.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_post_coinit/unknwn.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_tlib_version_checker.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/_vtbl.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/clear_cache.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/__init__.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/_code_cache.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/_constants.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/_generate.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/_managing.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/dynamic.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/client/lazybind.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/connectionpoints.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/errorinfo.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/hresult.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/malloc.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/patcher.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/persist.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/server/__init__.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/server/automation.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/server/connectionpoints.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/server/inprocserver.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/server/localserver.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/server/register.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/server/w_getopt.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/shelllink.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/stream.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/TestComServer.idl +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/TestComServer.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/TestComServer.tlb +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/TestDispServer.idl +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/TestDispServer.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/TestDispServer.tlb +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/__init__.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/find_memleak.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/gdi_helper.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/monikers_helper.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/mylib.idl +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/mylib.tlb +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/mytypelib.idl +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/runtests.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/setup.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_BSTR.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_DISPPARAMS.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_GUID.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_QueryService.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_agilent.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_avmc.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_bctx.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_casesensitivity.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_classfactory.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_clear_cache.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_client_dynamic.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_client_regenerate_modules.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_collections.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_comobject.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_connectionpoints.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_createwrappers.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_dict.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_dispifc_records.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_dispifc_safearrays.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_dispinterface.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_dyndispatch.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_errorinfo.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_findgendir.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_getactiveobj.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_hresult.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_ienum.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_imfattributes.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_inout_args.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_jscript.js +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_malloc.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_messageloop.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_moniker.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_msscript.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_outparam.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_persist.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_pump_events.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_puredispatch.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_recordinfo.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_rot.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_safearray.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_sapi.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_server.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_server_automation.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_server_register.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_shelllink.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_showevents.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_storage.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_stream.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_subinterface.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_typeinfo.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_typeinfo_create.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_urlhistory.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_util.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_variant_outparam.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_viewobject.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_w_getopt.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_win32com_interop.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/test_word.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/time_structs_helper.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/test/urlhist.tlb +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/__init__.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/codegenerator/__init__.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/tools/codegenerator/modulenamer.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/typeinfo.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes/viewobject.py +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes.egg-info/dependency_links.txt +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes.egg-info/entry_points.txt +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/comtypes.egg-info/top_level.txt +0 -0
- {comtypes-1.4.16 → comtypes-1.5.0}/setup.cfg +0 -0
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
Comtypes CHANGELOG
|
|
2
2
|
==================
|
|
3
3
|
|
|
4
|
+
Release 1.5.0
|
|
5
|
+
--------------
|
|
6
|
+
* Bump GitHub Actions dependencies. By @junkmd.
|
|
7
|
+
* Refactor enum member iteration in code generator namespaces. By @junkmd.
|
|
8
|
+
* Expose inline typing metadata to type checkers. By @Robolightning.
|
|
9
|
+
* Modernize ``test_pip_install.py`` and include in ``autofmt`` workflow. By @junkmd.
|
|
10
|
+
* Introduce CI type-checking harness. By @junkmd.
|
|
11
|
+
* Add documentations for developers on how this package supports static typing. By @junkmd.
|
|
12
|
+
* Restore numeric ``SAFEARRAY`` to ``numpy.ndarray`` conversion. By @haoxuanjng-lang.
|
|
13
|
+
* Add Python 3.15 to CI matrix. By @junkmd.
|
|
14
|
+
* Support Python 3.15 ``PyCArgObject`` struct layout changes. By @junkmd.
|
|
15
|
+
* Update the code generator to handle Python 3.15's changes to ``enum.IntFlag``. By @junkmd.
|
|
16
|
+
* Add tests for explicit string ``SAFEARRAY`` types inside ``VARIANT``s. By @junkmd.
|
|
17
|
+
* Remove ``setup_logging`` from ``comtypes.logutil``. By @junkmd.
|
|
18
|
+
* Support ``VT_ERROR`` variant type. By @junkmd.
|
|
19
|
+
* Remove ``..._Impl`` comments generation and add member‑level docstrings under ``if TYPE_CHECKING``. By @junkmd.
|
|
20
|
+
* Add tests to show the problems with the current ``VT_I1`` mapping in ``tlbparser``. By @haoxuanjng-lang.
|
|
21
|
+
* Clarify ``ctypes`` ``_b_needsfree_`` ownership in ``tagVARIANT`` and add tests. By @junkmd.
|
|
22
|
+
* Use ``sysmon`` for coverage on Python 3.12. By @junkmd.
|
|
23
|
+
* Resolve remaining type-checking errors. By @junkmd.
|
|
24
|
+
* Improve ``IEnumVARIANT`` type hints. By @junkmd.
|
|
25
|
+
* Refactor ``tlbparser`` and ``codegenerator``. By @junkmd.
|
|
26
|
+
* Improve fixed-point number marshaling and ``VARIANT`` support. By @junkmd.
|
|
27
|
+
* Add record ``SAFEARRAY`` support. By @mementum and @junkmd.
|
|
28
|
+
* Update docs for Python 3.15 support. By @junkmd.
|
|
29
|
+
|
|
30
|
+
Release 1.4.17
|
|
31
|
+
--------------
|
|
32
|
+
* Unify Windows message handling APIs in ``messageloop.py``. By @junkmd.
|
|
33
|
+
* Replace Internet Explorer with MSXML in ``test_eventinterface.py``. By @junkmd.
|
|
34
|
+
* Improve error handling for ``GetEvents`` with currently unsupported COM servers. By @junkmd.
|
|
35
|
+
* Refactor ``test_basic.py`` to use public APIs. By @junkmd.
|
|
36
|
+
* Skip tests using ``util`` on Python 3.15 alpha/beta. By @junkmd.
|
|
37
|
+
* Refine type hints for COM object creation and retrieval. By @junkmd.
|
|
38
|
+
* Modernize ``IGlobalInterfaceTable`` with type hints. By @junkmd.
|
|
39
|
+
* Fix ``UnboundLocalError`` when all struct packings fail in ``calc_packing``. By @ryanda9910.
|
|
40
|
+
|
|
4
41
|
Release 1.4.16
|
|
5
42
|
--------------
|
|
6
43
|
* Decompose ``IStorage`` tests and enhance coverage. By @junkmd.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: comtypes
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Pure Python COM package
|
|
5
5
|
Author-email: Thomas Heller <theller@python.net>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,11 +33,7 @@ Dynamic: license-file
|
|
|
33
33
|
|
|
34
34
|
`comtypes` requires Windows and Python 3.9 or later.
|
|
35
35
|
|
|
36
|
-
-
|
|
37
|
-
Starting with Python 3.15, the internal handling of `IntFlag`(`Flag`) values is planned to change:
|
|
38
|
-
**Negative `IntFlag` members will be reinterpreted by masking them to the defined positive bit domain, instead of keeping their original negative literal values**.
|
|
39
|
-
This can affect enumeration types generated by `comtypes` from COM type libraries. Action is needed to maintain literal evaluation.
|
|
40
|
-
For details and ongoing discussion, see: [GH-894](https://github.com/enthought/comtypes/issues/894).
|
|
36
|
+
- Version <= [1.4.17](https://pypi.org/project/comtypes/1.4.17/) has issues with enum behavior on Python 3.15 as reported in [GH-894](https://github.com/enthought/comtypes/issues/894). Version [1.5.0](https://pypi.org/project/comtypes/1.5.0/) supports Python 3.15.
|
|
41
37
|
- Version [1.4.12](https://pypi.org/project/comtypes/1.4.12/) is the last version to support Python 3.8.
|
|
42
38
|
- Version <= [1.4.7](https://pypi.org/project/comtypes/1.4.7/) does not work with Python 3.13 as reported in [GH-618](https://github.com/enthought/comtypes/issues/618). Version [1.4.8](https://pypi.org/project/comtypes/1.4.8/) can work with Python 3.13.
|
|
43
39
|
- Version [1.4.6](https://pypi.org/project/comtypes/1.4.6/) is the last version to support Python 3.7.
|
|
@@ -87,7 +83,7 @@ For as long as COM is not supported outside of Windows, there is no plan to port
|
|
|
87
83
|
|
|
88
84
|
### Q: Why does `cannot import name 'COMError' from '_ctypes'` error occur when using this package on platforms other than Windows?
|
|
89
85
|
**A:** The [`_ctypes`](https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c) is part of the internal implementation of the [`ctypes`](https://github.com/python/cpython/blob/main/Lib/ctypes/) standard library that exists for Python on all platforms.
|
|
90
|
-
However, `COMError` and COM-related features are only implemented in Python for Windows.
|
|
86
|
+
However, [`COMError`](https://docs.python.org/3/library/ctypes.html#ctypes.COMError) and COM-related features are only implemented in Python for Windows.
|
|
91
87
|
|
|
92
88
|
In cross-platform software development, care must be taken to ensure that codebases that depend on `comtypes` do not execute in environments other than Windows.
|
|
93
89
|
|
|
@@ -13,11 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
`comtypes` requires Windows and Python 3.9 or later.
|
|
15
15
|
|
|
16
|
-
-
|
|
17
|
-
Starting with Python 3.15, the internal handling of `IntFlag`(`Flag`) values is planned to change:
|
|
18
|
-
**Negative `IntFlag` members will be reinterpreted by masking them to the defined positive bit domain, instead of keeping their original negative literal values**.
|
|
19
|
-
This can affect enumeration types generated by `comtypes` from COM type libraries. Action is needed to maintain literal evaluation.
|
|
20
|
-
For details and ongoing discussion, see: [GH-894](https://github.com/enthought/comtypes/issues/894).
|
|
16
|
+
- Version <= [1.4.17](https://pypi.org/project/comtypes/1.4.17/) has issues with enum behavior on Python 3.15 as reported in [GH-894](https://github.com/enthought/comtypes/issues/894). Version [1.5.0](https://pypi.org/project/comtypes/1.5.0/) supports Python 3.15.
|
|
21
17
|
- Version [1.4.12](https://pypi.org/project/comtypes/1.4.12/) is the last version to support Python 3.8.
|
|
22
18
|
- Version <= [1.4.7](https://pypi.org/project/comtypes/1.4.7/) does not work with Python 3.13 as reported in [GH-618](https://github.com/enthought/comtypes/issues/618). Version [1.4.8](https://pypi.org/project/comtypes/1.4.8/) can work with Python 3.13.
|
|
23
19
|
- Version [1.4.6](https://pypi.org/project/comtypes/1.4.6/) is the last version to support Python 3.7.
|
|
@@ -67,7 +63,7 @@ For as long as COM is not supported outside of Windows, there is no plan to port
|
|
|
67
63
|
|
|
68
64
|
### Q: Why does `cannot import name 'COMError' from '_ctypes'` error occur when using this package on platforms other than Windows?
|
|
69
65
|
**A:** The [`_ctypes`](https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c) is part of the internal implementation of the [`ctypes`](https://github.com/python/cpython/blob/main/Lib/ctypes/) standard library that exists for Python on all platforms.
|
|
70
|
-
However, `COMError` and COM-related features are only implemented in Python for Windows.
|
|
66
|
+
However, [`COMError`](https://docs.python.org/3/library/ctypes.html#ctypes.COMError) and COM-related features are only implemented in Python for Windows.
|
|
71
67
|
|
|
72
68
|
In cross-platform software development, care must be taken to ensure that codebases that depend on `comtypes` do not execute in environments other than Windows.
|
|
73
69
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# comtypes version numbers follow semver (http://semver.org/) and PEP 440
|
|
2
|
-
__version__ = "1.
|
|
2
|
+
__version__ = "1.5.0"
|
|
3
3
|
|
|
4
4
|
try:
|
|
5
5
|
from _ctypes import COMError # noqa
|
|
@@ -18,22 +18,6 @@ import atexit
|
|
|
18
18
|
import logging
|
|
19
19
|
import sys
|
|
20
20
|
|
|
21
|
-
if sys.version_info >= (3, 15):
|
|
22
|
-
import warnings
|
|
23
|
-
|
|
24
|
-
_PYVER = f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
25
|
-
warnings.warn(
|
|
26
|
-
(
|
|
27
|
-
f"You are running 'comtypes' on Python {_PYVER}, where the behavior of "
|
|
28
|
-
"enum types (such as IntFlag) may differ from Python <= 3.14.\n"
|
|
29
|
-
f"It is recommended to use a version compatible with Python {_PYVER}.\n"
|
|
30
|
-
"See: https://github.com/enthought/comtypes/issues/894"
|
|
31
|
-
),
|
|
32
|
-
FutureWarning,
|
|
33
|
-
stacklevel=2,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
21
|
# HACK: Workaround for projects that depend on this package
|
|
38
22
|
# There should be several projects around the world that depend on this package
|
|
39
23
|
# and indirectly reference the symbols of `ctypes` from `comtypes`.
|
|
@@ -53,8 +37,8 @@ else:
|
|
|
53
37
|
|
|
54
38
|
from comtypes import patcher # noqa
|
|
55
39
|
from comtypes._npsupport import interop as npsupport # noqa
|
|
56
|
-
from comtypes._tlib_version_checker import _check_version # noqa
|
|
57
|
-
from comtypes.GUID import GUID
|
|
40
|
+
from comtypes._tlib_version_checker import _check_version as _check_version # noqa
|
|
41
|
+
from comtypes.GUID import GUID as GUID
|
|
58
42
|
|
|
59
43
|
_all_slice = slice(None, None, None)
|
|
60
44
|
|
|
@@ -198,31 +182,34 @@ com_coclass_registry: dict[str, type["CoClass"]] = {}
|
|
|
198
182
|
# IDL stuff
|
|
199
183
|
|
|
200
184
|
from comtypes._memberspec import ( # noqa
|
|
201
|
-
COMMETHOD,
|
|
202
|
-
DISPMETHOD,
|
|
203
|
-
DISPPROPERTY,
|
|
204
|
-
STDMETHOD,
|
|
205
|
-
defaultvalue,
|
|
206
|
-
dispid,
|
|
207
|
-
helpstring,
|
|
185
|
+
COMMETHOD as COMMETHOD,
|
|
186
|
+
DISPMETHOD as DISPMETHOD,
|
|
187
|
+
DISPPROPERTY as DISPPROPERTY,
|
|
188
|
+
STDMETHOD as STDMETHOD,
|
|
189
|
+
defaultvalue as defaultvalue,
|
|
190
|
+
dispid as dispid,
|
|
191
|
+
helpstring as helpstring,
|
|
208
192
|
)
|
|
209
193
|
|
|
210
194
|
################################################################
|
|
211
195
|
# IUnknown, the root of all evil...
|
|
212
196
|
from comtypes._post_coinit import _shutdown
|
|
213
|
-
from comtypes._post_coinit.unknwn import IUnknown # noqa
|
|
197
|
+
from comtypes._post_coinit.unknwn import IUnknown as IUnknown # noqa
|
|
214
198
|
|
|
215
199
|
atexit.register(_shutdown)
|
|
216
200
|
|
|
217
201
|
################################################################
|
|
218
202
|
|
|
219
|
-
from comtypes._post_coinit.bstr import BSTR # noqa
|
|
203
|
+
from comtypes._post_coinit.bstr import BSTR as BSTR # noqa
|
|
220
204
|
|
|
221
205
|
|
|
222
206
|
################################################################
|
|
223
207
|
# IPersist is a trivial interface, which allows to ask an object about
|
|
224
208
|
# its clsid.
|
|
225
|
-
from comtypes._post_coinit.misc import
|
|
209
|
+
from comtypes._post_coinit.misc import (
|
|
210
|
+
IPersist as IPersist,
|
|
211
|
+
IServiceProvider as IServiceProvider,
|
|
212
|
+
) # noqa
|
|
226
213
|
|
|
227
214
|
|
|
228
215
|
################################################################
|
|
@@ -232,39 +219,39 @@ from comtypes._post_coinit.instancemethod import instancemethod # noqa
|
|
|
232
219
|
from comtypes._post_coinit.activeobj import ( # noqa
|
|
233
220
|
ACTIVEOBJECT_STRONG,
|
|
234
221
|
ACTIVEOBJECT_WEAK,
|
|
235
|
-
GetActiveObject,
|
|
222
|
+
GetActiveObject as GetActiveObject,
|
|
236
223
|
RegisterActiveObject,
|
|
237
224
|
RevokeActiveObject,
|
|
238
225
|
)
|
|
239
226
|
from comtypes._post_coinit.misc import ( # noqa
|
|
240
227
|
_is_object,
|
|
241
|
-
CoGetObject,
|
|
242
|
-
CoCreateInstance,
|
|
243
|
-
CoGetClassObject,
|
|
244
|
-
MULTI_QI,
|
|
228
|
+
CoGetObject as CoGetObject,
|
|
229
|
+
CoCreateInstance as CoCreateInstance,
|
|
230
|
+
CoGetClassObject as CoGetClassObject,
|
|
231
|
+
MULTI_QI as MULTI_QI,
|
|
245
232
|
_COAUTHIDENTITY,
|
|
246
|
-
COAUTHIDENTITY,
|
|
233
|
+
COAUTHIDENTITY as COAUTHIDENTITY,
|
|
247
234
|
_COAUTHINFO,
|
|
248
|
-
COAUTHINFO,
|
|
235
|
+
COAUTHINFO as COAUTHINFO,
|
|
249
236
|
_COSERVERINFO,
|
|
250
|
-
COSERVERINFO,
|
|
237
|
+
COSERVERINFO as COSERVERINFO,
|
|
251
238
|
_CoGetClassObject,
|
|
252
|
-
tagBIND_OPTS,
|
|
253
|
-
BIND_OPTS,
|
|
254
|
-
tagBIND_OPTS2,
|
|
255
|
-
BINDOPTS2,
|
|
239
|
+
tagBIND_OPTS as tagBIND_OPTS,
|
|
240
|
+
BIND_OPTS as BIND_OPTS,
|
|
241
|
+
tagBIND_OPTS2 as tagBIND_OPTS2,
|
|
242
|
+
BINDOPTS2 as BINDOPTS2,
|
|
256
243
|
_SEC_WINNT_AUTH_IDENTITY,
|
|
257
|
-
SEC_WINNT_AUTH_IDENTITY,
|
|
244
|
+
SEC_WINNT_AUTH_IDENTITY as SEC_WINNT_AUTH_IDENTITY,
|
|
258
245
|
_SOLE_AUTHENTICATION_INFO,
|
|
259
|
-
SOLE_AUTHENTICATION_INFO,
|
|
246
|
+
SOLE_AUTHENTICATION_INFO as SOLE_AUTHENTICATION_INFO,
|
|
260
247
|
_SOLE_AUTHENTICATION_LIST,
|
|
261
|
-
SOLE_AUTHENTICATION_LIST,
|
|
262
|
-
CoCreateInstanceEx,
|
|
248
|
+
SOLE_AUTHENTICATION_LIST as SOLE_AUTHENTICATION_LIST,
|
|
249
|
+
CoCreateInstanceEx as CoCreateInstanceEx,
|
|
263
250
|
)
|
|
264
251
|
|
|
265
252
|
|
|
266
253
|
################################################################
|
|
267
|
-
from comtypes._comobject import COMObject
|
|
254
|
+
from comtypes._comobject import COMObject as COMObject
|
|
268
255
|
|
|
269
256
|
# What's a coclass?
|
|
270
257
|
# a POINTER to a coclass is allowed as parameter in a function declaration:
|
|
@@ -165,19 +165,88 @@ class dispid(int):
|
|
|
165
165
|
# instances with more methods or properties, and should not behave as an unpackable.
|
|
166
166
|
|
|
167
167
|
|
|
168
|
-
def STDMETHOD(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
def STDMETHOD(
|
|
169
|
+
restype: Optional[type["_CDataType"]],
|
|
170
|
+
name: str,
|
|
171
|
+
argtypes: Sequence[type["_CDataType"]] = (),
|
|
172
|
+
) -> _ComMemberSpec:
|
|
173
|
+
"""Specifies a COM method slot without idlflags.
|
|
174
|
+
|
|
175
|
+
Use this when the method requires no parameter direction annotations
|
|
176
|
+
(`'in'`, `'out'`, etc.) and no helpstring. If any of those are
|
|
177
|
+
needed, use `COMMETHOD` instead.
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
restype: The return type of the vtable method. Typically
|
|
181
|
+
`HRESULT` or a primitive `ctypes` type.
|
|
182
|
+
Pass `None` when the method is declared `void`.
|
|
183
|
+
name: The name of the COM method.
|
|
184
|
+
argtypes: A sequence of `ctypes` types describing the raw
|
|
185
|
+
parameters of the vtable slot, in declaration order.
|
|
186
|
+
Defaults to an empty sequence when the method takes no
|
|
187
|
+
parameters.
|
|
188
|
+
"""
|
|
189
|
+
return _ComMemberSpec(restype, name, tuple(argtypes), None, (), None)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def DISPMETHOD(
|
|
193
|
+
idlflags: Sequence[_UnionT[int, str]],
|
|
194
|
+
restype: Optional[type["_CDataType"]],
|
|
195
|
+
name: str,
|
|
196
|
+
*argspec: "hints.ArgSpecElmType",
|
|
197
|
+
) -> _DispMemberSpec:
|
|
198
|
+
"""Specifies a method of a dispinterface.
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
idlflags: A sequence that describes the method itself.
|
|
202
|
+
Must contain a `dispid` instance (an `int` subclass) that
|
|
203
|
+
carries the `DISPID` of this member. May also contain string
|
|
204
|
+
flags that control how the method is exposed.
|
|
205
|
+
restype: The return type of the dispatch method as a `ctypes`
|
|
206
|
+
type, or `None` when the method returns nothing (`void`).
|
|
207
|
+
name: The name of the dispatch method.
|
|
208
|
+
argspec: Zero or more argument specifiers, each describing one
|
|
209
|
+
parameter of the method. Each element is a tuple that can be:
|
|
210
|
+
- `(flags, type)` for a parameter with no name.
|
|
211
|
+
- `(flags, type, name)` for a named parameter.
|
|
212
|
+
- `(flags, type, name, default)` for a named parameter with
|
|
213
|
+
a default value.
|
|
214
|
+
- `flags` is a list of strings chosen from `'in'`, `'out'`,
|
|
215
|
+
`'lcid'`, `'retval'`, and `'optional'`.
|
|
216
|
+
Pass `[]` for a plain input parameter with no special
|
|
217
|
+
attributes.
|
|
218
|
+
"""
|
|
219
|
+
return _DispMemberSpec(
|
|
220
|
+
"DISPMETHOD",
|
|
221
|
+
name,
|
|
222
|
+
tuple(idlflags), # type: ignore
|
|
223
|
+
restype,
|
|
224
|
+
argspec,
|
|
225
|
+
)
|
|
176
226
|
|
|
177
227
|
|
|
178
|
-
def DISPPROPERTY(
|
|
179
|
-
|
|
180
|
-
|
|
228
|
+
def DISPPROPERTY(
|
|
229
|
+
idlflags: Sequence[_UnionT[int, str]],
|
|
230
|
+
proptype: type["_CDataType"],
|
|
231
|
+
name: str,
|
|
232
|
+
) -> _DispMemberSpec:
|
|
233
|
+
"""Specifies a property of a dispinterface.
|
|
234
|
+
|
|
235
|
+
Args:
|
|
236
|
+
idlflags: A sequence that describes the property itself. Must
|
|
237
|
+
contain a `dispid` instance (a subclass of `int`) that
|
|
238
|
+
carries the `DISPID` of this member. May also contain string
|
|
239
|
+
flags that control how the property is exposed.
|
|
240
|
+
proptype: The `ctypes` type of the property value.
|
|
241
|
+
name: The name of the dispatch property.
|
|
242
|
+
"""
|
|
243
|
+
return _DispMemberSpec(
|
|
244
|
+
"DISPPROPERTY",
|
|
245
|
+
name,
|
|
246
|
+
tuple(idlflags), # type: ignore
|
|
247
|
+
proptype,
|
|
248
|
+
(),
|
|
249
|
+
)
|
|
181
250
|
|
|
182
251
|
|
|
183
252
|
# tuple(idlflags) is for the method itself: (dispid, 'readonly')
|
|
@@ -189,10 +258,38 @@ def DISPPROPERTY(idlflags, proptype, name) -> _DispMemberSpec:
|
|
|
189
258
|
# )
|
|
190
259
|
|
|
191
260
|
|
|
192
|
-
def COMMETHOD(
|
|
261
|
+
def COMMETHOD(
|
|
262
|
+
idlflags: Sequence[_UnionT[int, str]],
|
|
263
|
+
restype: Optional[type["_CDataType"]],
|
|
264
|
+
methodname: str,
|
|
265
|
+
*argspec: "hints.ArgSpecElmType",
|
|
266
|
+
) -> _ComMemberSpec:
|
|
193
267
|
"""Specifies a COM method slot with idlflags.
|
|
194
268
|
|
|
195
|
-
|
|
269
|
+
Args:
|
|
270
|
+
idlflags: A sequence that describes the method or property itself.
|
|
271
|
+
Elements may be:
|
|
272
|
+
- String flags that control how the slot is exposed.
|
|
273
|
+
- A `helpstring` instance (a `str` subclass) whose
|
|
274
|
+
text is used as the method's docstring.
|
|
275
|
+
- A `dispid` instance (an `int` subclass) that
|
|
276
|
+
carries the `DISPID` when the method is part of a dual
|
|
277
|
+
interface.
|
|
278
|
+
- Pass `[]` for a regular vtable method with no special
|
|
279
|
+
attributes.
|
|
280
|
+
restype: The return type of the vtable method. Typically
|
|
281
|
+
`HRESULT`. Pass `None` when the method is `void`.
|
|
282
|
+
methodname: The name of the COM method or property.
|
|
283
|
+
argspec: Zero or more argument specifiers, each describing one
|
|
284
|
+
parameter of the method. Each element is a tuple that can be:
|
|
285
|
+
- `(flags, type)` for a parameter with no name.
|
|
286
|
+
- `(flags, type, name)` for a named parameter.
|
|
287
|
+
- `(flags, type, name, default)` for a named parameter with
|
|
288
|
+
a default value.
|
|
289
|
+
- `flags` is a list of strings chosen from `'in'`, `'out'`,
|
|
290
|
+
`'lcid'`, `'retval'`, and `'optional'`.
|
|
291
|
+
Pass `[]` for a plain input parameter with no special
|
|
292
|
+
attributes.
|
|
196
293
|
"""
|
|
197
294
|
# collect all helpstring instances
|
|
198
295
|
# We should suppress docstrings when Python is started with -OO
|
|
@@ -208,7 +305,12 @@ def COMMETHOD(idlflags, restype, methodname, *argspec) -> _ComMemberSpec:
|
|
|
208
305
|
else:
|
|
209
306
|
name = methodname
|
|
210
307
|
return _ComMemberSpec(
|
|
211
|
-
restype,
|
|
308
|
+
restype,
|
|
309
|
+
name,
|
|
310
|
+
argtypes,
|
|
311
|
+
paramflags,
|
|
312
|
+
tuple(idlflags), # type: ignore
|
|
313
|
+
helptext,
|
|
212
314
|
)
|
|
213
315
|
|
|
214
316
|
|
|
@@ -14,6 +14,7 @@ from ctypes import (
|
|
|
14
14
|
)
|
|
15
15
|
from ctypes.wintypes import DWORD, LPCWSTR, LPVOID
|
|
16
16
|
from typing import TYPE_CHECKING, Any, Optional, TypeVar, overload
|
|
17
|
+
from typing import Union as _UnionT
|
|
17
18
|
|
|
18
19
|
from comtypes import CLSCTX_LOCAL_SERVER, CLSCTX_REMOTE_SERVER, CLSCTX_SERVER, GUID
|
|
19
20
|
from comtypes._memberspec import COMMETHOD
|
|
@@ -21,7 +22,7 @@ from comtypes._post_coinit.unknwn import IUnknown
|
|
|
21
22
|
from comtypes.GUID import REFCLSID
|
|
22
23
|
|
|
23
24
|
if TYPE_CHECKING:
|
|
24
|
-
from ctypes import _Pointer
|
|
25
|
+
from ctypes import _CArgObject, _Pointer
|
|
25
26
|
|
|
26
27
|
from comtypes import hints as hints # noqa # type: ignore
|
|
27
28
|
|
|
@@ -146,20 +147,20 @@ def CoCreateInstance(
|
|
|
146
147
|
def CoGetClassObject(
|
|
147
148
|
clsid: GUID,
|
|
148
149
|
clsctx: Optional[int] = None,
|
|
149
|
-
pServerInfo: "
|
|
150
|
+
pServerInfo: "_UnionT[None, _CArgObject, COSERVERINFO]" = None,
|
|
150
151
|
interface: None = None,
|
|
151
152
|
) -> "hints.IClassFactory": ...
|
|
152
153
|
@overload
|
|
153
154
|
def CoGetClassObject(
|
|
154
155
|
clsid: GUID,
|
|
155
156
|
clsctx: Optional[int] = None,
|
|
156
|
-
pServerInfo: "
|
|
157
|
+
pServerInfo: "_UnionT[None, _CArgObject, COSERVERINFO]" = None,
|
|
157
158
|
interface: type[_T_IUnknown] = IUnknown,
|
|
158
159
|
) -> _T_IUnknown: ...
|
|
159
160
|
def CoGetClassObject(
|
|
160
161
|
clsid: GUID,
|
|
161
162
|
clsctx: Optional[int] = None,
|
|
162
|
-
pServerInfo: "
|
|
163
|
+
pServerInfo: "_UnionT[None, _CArgObject, COSERVERINFO]" = None,
|
|
163
164
|
interface: Optional[type[IUnknown]] = None,
|
|
164
165
|
) -> IUnknown:
|
|
165
166
|
if clsctx is None:
|
|
@@ -337,7 +338,7 @@ def CoCreateInstanceEx(
|
|
|
337
338
|
interface: None = None,
|
|
338
339
|
clsctx: Optional[int] = None,
|
|
339
340
|
machine: Optional[str] = None,
|
|
340
|
-
pServerInfo:
|
|
341
|
+
pServerInfo: "_UnionT[None, _CArgObject, COSERVERINFO]" = None,
|
|
341
342
|
) -> IUnknown: ...
|
|
342
343
|
@overload
|
|
343
344
|
def CoCreateInstanceEx(
|
|
@@ -345,14 +346,14 @@ def CoCreateInstanceEx(
|
|
|
345
346
|
interface: type[_T_IUnknown],
|
|
346
347
|
clsctx: Optional[int] = None,
|
|
347
348
|
machine: Optional[str] = None,
|
|
348
|
-
pServerInfo:
|
|
349
|
+
pServerInfo: "_UnionT[None, _CArgObject, COSERVERINFO]" = None,
|
|
349
350
|
) -> _T_IUnknown: ...
|
|
350
351
|
def CoCreateInstanceEx(
|
|
351
352
|
clsid: GUID,
|
|
352
353
|
interface: Optional[type[IUnknown]] = None,
|
|
353
354
|
clsctx: Optional[int] = None,
|
|
354
355
|
machine: Optional[str] = None,
|
|
355
|
-
pServerInfo:
|
|
356
|
+
pServerInfo: "_UnionT[None, _CArgObject, COSERVERINFO]" = None,
|
|
356
357
|
) -> IUnknown:
|
|
357
358
|
"""The basic windows api to create a COM class object and return a
|
|
358
359
|
pointer to an interface, possibly on another machine.
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"""SAFEARRAY api functions, data types, and constants."""
|
|
2
2
|
|
|
3
|
-
from ctypes import POINTER, Structure, WinDLL, c_uint, c_ushort, c_void_p
|
|
3
|
+
from ctypes import POINTER, Structure, WinDLL, byref, c_uint, c_ushort, c_void_p
|
|
4
4
|
from ctypes.wintypes import DWORD, LONG, UINT, USHORT
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
5
6
|
|
|
6
7
|
from comtypes import GUID, HRESULT
|
|
7
8
|
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ctypes import _Pointer
|
|
11
|
+
|
|
12
|
+
from comtypes import hints # type: ignore
|
|
13
|
+
|
|
8
14
|
################################################################
|
|
9
15
|
# if __debug__:
|
|
10
16
|
# from ctypeslib.dynamic_module import include
|
|
@@ -78,6 +84,31 @@ def SafeArrayGetVartype(pa):
|
|
|
78
84
|
return result.value
|
|
79
85
|
|
|
80
86
|
|
|
87
|
+
_SafeArrayGetRecordInfo = _oleaut32.SafeArrayGetRecordInfo
|
|
88
|
+
_SafeArrayGetRecordInfo.restype = HRESULT
|
|
89
|
+
_SafeArrayGetRecordInfo.argtypes = [POINTER(SAFEARRAY), POINTER(c_void_p)]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def SafeArrayGetRecordInfo(pa: "_Pointer[tagSAFEARRAY]") -> "hints.IRecordInfo":
|
|
93
|
+
# Defined here to avoid a circular import
|
|
94
|
+
from comtypes.typeinfo import IRecordInfo
|
|
95
|
+
|
|
96
|
+
result = POINTER(IRecordInfo)()
|
|
97
|
+
_SafeArrayGetRecordInfo(pa, byref(result))
|
|
98
|
+
return result # type: ignore
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
_SafeArrayCopy = _oleaut32.SafeArrayCopy
|
|
102
|
+
_SafeArrayCopy.restype = HRESULT
|
|
103
|
+
_SafeArrayCopy.argtypes = [POINTER(SAFEARRAY), POINTER(POINTER(SAFEARRAY))]
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def SafeArrayCopy(pa: "_Pointer[SAFEARRAY]") -> "hints.LP_SAFEARRAY":
|
|
107
|
+
result = POINTER(SAFEARRAY)()
|
|
108
|
+
_SafeArrayCopy(pa, byref(result))
|
|
109
|
+
return result # type: ignore
|
|
110
|
+
|
|
111
|
+
|
|
81
112
|
SafeArrayGetElement = _oleaut32.SafeArrayGetElement
|
|
82
113
|
SafeArrayGetElement.restype = HRESULT
|
|
83
114
|
SafeArrayGetElement.argtypes = [POINTER(SAFEARRAY), POINTER(LONG), c_void_p]
|