From ea139a95f809c3f9166eb5b0aab730cbb8a4c77d Mon Sep 17 00:00:00 2001 From: Jun Komoda <45822440+junkmd@users.noreply.github.com> Date: Thu, 8 Aug 2024 20:08:47 +0900 Subject: [PATCH] Rename `_byref_type` and `_carg_obj` to `_CArgObject`. (#597) --- comtypes/automation.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/comtypes/automation.py b/comtypes/automation.py index 6d9a18bb..596d0481 100644 --- a/comtypes/automation.py +++ b/comtypes/automation.py @@ -16,9 +16,11 @@ import comtypes if TYPE_CHECKING: + from ctypes import _CArgObject from comtypes import hints # type: ignore from comtypes import _safearray else: + _CArgObject = type(byref(c_int())) try: from comtypes import _safearray except (ImportError, AttributeError): @@ -50,7 +52,6 @@ class _safearray(object): # helpers IID_NULL = GUID() riid_null = byref(IID_NULL) -_byref_type = type(byref(c_int())) # 30. December 1899, midnight. For VT_DATE. _com_null_date = datetime.datetime(1899, 12, 30, 0, 0, 0) @@ -382,7 +383,7 @@ def _set_value(self, value): elif isinstance(value, c_uint64): self.vt = VT_UI8 self._.VT_UI8 = value - elif isinstance(value, _byref_type): + elif isinstance(value, _CArgObject): ref = value._obj self._.c_void_p = addressof(ref) self.__keepref = value @@ -609,8 +610,6 @@ def ChangeType(self, typecode): v._.VT_I4 = 0x80020004 del v -_carg_obj = type(byref(c_int())) - @comtypes.patcher.Patch(POINTER(VARIANT)) class _(object): @@ -625,7 +624,7 @@ def from_param(cls, arg): if isinstance(arg, POINTER(VARIANT)): return arg # accept byref(VARIANT) instance - if isinstance(arg, _carg_obj) and isinstance(arg._obj, VARIANT): + if isinstance(arg, _CArgObject) and isinstance(arg._obj, VARIANT): return arg # accept VARIANT instance if isinstance(arg, VARIANT):