Skip to content

Commit

Permalink
Add a HACK comment to _cominterface_meta.__new__.
Browse files Browse the repository at this point in the history
  • Loading branch information
junkmd committed Oct 7, 2024
1 parent 4258c98 commit b1b9810
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions comtypes/_post_coinit/unknwn.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ def __new__(cls, name, bases, namespace):
_ptr_bases = (self, POINTER(bases[0]))

# The interface 'self' is used as a mixin.
# HACK: Could `type(_compointer_base)` be replaced with `_compointer_meta`?
# `type(klass)` returns its metaclass.
# Since this specification, `type(_compointer_base)` will return
# `_compointer_meta` as per the class definition.
# This implementation might be a remnant of the differences in how metaclasses
# work between Python 3.x and Python 2.x.
# The reason for this implementation might be a remnant of the differences in
# how metaclasses function between Python 3.x and Python 2.x.
# If there are no problems with the versions of Python that `comtypes`
# supports, this replacement could make the process flow easier to understand.
p = type(_compointer_base)(
f"POINTER({self.__name__})",
_ptr_bases,
Expand Down

0 comments on commit b1b9810

Please sign in to comment.