Skip to content

Commit

Permalink
This is a change that reproduces the issue
Browse files Browse the repository at this point in the history
where it runs successfully on Python 3.13, but a `NameError` occurs
on Python 3.11.

It corresponds to an updated version of the reproducer reported at
python/cpython#124520 (comment).
  • Loading branch information
junkmd committed Sep 29, 2024
1 parent 9d3935e commit 684a559
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions comtypes/_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,26 @@ class _coclass_meta(type):
# will QueryInterface for the default interface: the first one on
# the coclass' _com_interfaces_ list.
def __new__(cls, name, bases, namespace):
klass = type.__new__(cls, name, bases, namespace)
return type.__new__(cls, name, bases, namespace)

def __init__(self, name, bases, namespace):
if bases == (object,):
return klass
return
# XXX We should insist that a _reg_clsid_ is present.
if "_reg_clsid_" in namespace:
clsid = namespace["_reg_clsid_"]
comtypes.com_coclass_registry[str(clsid)] = klass
comtypes.com_coclass_registry[str(clsid)] = self
PTR = _coclass_pointer_meta(
"POINTER(%s)" % klass.__name__,
(klass, c_void_p),
"POINTER(%s)" % self.__name__,
(self, c_void_p),
{
"__ctypes_from_outparam__": _wrap_coclass,
"from_param": classmethod(_coclass_from_param),
},
)
from ctypes import _pointer_type_cache

_pointer_type_cache[klass] = PTR

return klass
_pointer_type_cache[self] = PTR


# will not work if we change the order of the two base classes!
Expand Down

0 comments on commit 684a559

Please sign in to comment.