Created
August 12, 2013 01:41
-
-
Save codito/6207739 to your computer and use it in GitHub Desktop.
Fix for metaclass conflict. Get the latest snapshot of comtypes from svn. Run 2to3.py refactoring. Then apply the following patch. (Tested with Python 3.3.2/Windows 8/x86).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
comtypes/__init__.py | 8 ++++++-- | |
comtypes/automation.py | 4 +++- | |
2 files changed, 9 insertions(+), 3 deletions(-) | |
diff --git a/comtypes/__init__.py b/comtypes/__init__.py | |
index 6590ead..fa604af 100644 | |
--- a/comtypes/__init__.py | |
+++ b/comtypes/__init__.py | |
@@ -268,7 +268,9 @@ class _cominterface_meta(type): | |
_pointer_type_cache[cls] = p | |
if cls._case_insensitive_: | |
- class p(partial.partial, p): | |
+ class _meta(type(partial.partial), type(p)): pass | |
+ | |
+ class p(partial.partial, p, metaclass=_meta): | |
# case insensitive attributes for COM methods and properties | |
def __getattr__(self, name): | |
"""Implement case insensitive access to methods and properties""" | |
@@ -292,7 +294,9 @@ class _cominterface_meta(type): | |
self.__map_case__.get(name.lower(), name), | |
value) | |
- class _(partial.partial, POINTER(p)): | |
+ class _meta(type(partial.partial), type(POINTER(p))): pass | |
+ | |
+ class _(partial.partial, POINTER(p), metaclass=_meta): | |
def __setitem__(self, index, value): | |
# We override the __setitem__ method of the | |
# POINTER(POINTER(interface)) type, so that the COM | |
diff --git a/comtypes/automation.py b/comtypes/automation.py | |
index f8bb80d..5108291 100644 | |
--- a/comtypes/automation.py | |
+++ b/comtypes/automation.py | |
@@ -515,7 +515,9 @@ del v | |
_carg_obj = type(byref(c_int())) | |
from _ctypes import Array as _CArrayType | |
-class _(partial, POINTER(VARIANT)): | |
+class _meta(type(partial), type(POINTER(VARIANT))): pass | |
+ | |
+class _(partial, POINTER(VARIANT), metaclass=_meta): | |
# Override the default .from_param classmethod of POINTER(VARIANT). | |
# This allows to pass values which can be stored in VARIANTs as | |
# function parameters declared as POINTER(VARIANT). See | |
-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment