Skip to content

Commit

Permalink
Rename _byref_type and _carg_obj to _CArgObject. (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
junkmd committed Aug 8, 2024
1 parent 82e4a2d commit ea139a9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions comtypes/automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit ea139a9

Please sign in to comment.