Skip to content

Commit d0295c4

Browse files
authored
Delint __InterlockedIncrement/...Decrement. (#832)
* Fix import source of `Unpack`. * Change the argument names in `IUnknown_AddRef` and `IUnknown_Release` from `__` prefixes to `_` prefixes. This resolves linter warnings that mistakenly interpreted the `__` prefix as the old-style positional-only arguments.
1 parent a4015d3 commit d0295c4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

comtypes/_comobject.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,10 @@ def __unkeep__(obj: "COMObject") -> None:
330330
def IUnknown_AddRef(
331331
self,
332332
this: Any,
333-
__InterlockedIncrement: Callable[[c_long], int] = _InterlockedIncrement,
333+
_increment: Callable[[c_long], int] = _InterlockedIncrement,
334334
_debug=_debug,
335335
) -> int:
336-
result = __InterlockedIncrement(self._refcnt)
336+
result = _increment(self._refcnt)
337337
if result == 1:
338338
self.__keep__(self)
339339
_debug("%r.AddRef() -> %s", self, result)
@@ -347,14 +347,14 @@ def _final_release_(self) -> None:
347347
def IUnknown_Release(
348348
self,
349349
this: Any,
350-
__InterlockedDecrement: Callable[[c_long], int] = _InterlockedDecrement,
350+
_decrement: Callable[[c_long], int] = _InterlockedDecrement,
351351
_debug=_debug,
352352
) -> int:
353353
# If this is called at COM shutdown, _InterlockedDecrement()
354354
# must still be available, although module level variables may
355355
# have been deleted already - so we supply it as default
356356
# argument.
357-
result = __InterlockedDecrement(self._refcnt)
357+
result = _decrement(self._refcnt)
358358
_debug("%r.Release() -> %s", self, result)
359359
if result == 0:
360360
self._final_release_()

comtypes/hints.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if sys.version_info >= (3, 11):
2424
from typing import Unpack as Unpack
2525
else:
2626
from typing_extensions import Self as Self
27-
from typing import Unpack as Unpack
27+
from typing_extensions import Unpack as Unpack
2828

2929
import comtypes
3030
from comtypes import IUnknown as IUnknown, COMObject as COMObject, GUID as GUID

0 commit comments

Comments
 (0)