summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PySide/QtCore/typesystem_core_win.xml27
1 files changed, 19 insertions, 8 deletions
diff --git a/PySide/QtCore/typesystem_core_win.xml b/PySide/QtCore/typesystem_core_win.xml
index 9982282..b55f04d 100644
--- a/PySide/QtCore/typesystem_core_win.xml
+++ b/PySide/QtCore/typesystem_core_win.xml
@@ -21,14 +21,25 @@
<typesystem package="PySide.QtCore">
<primitive-type name="HWND">
<conversion-rule file="glue/hwnd_conversions.h">
- <native-to-target>
- return PyCObject_FromVoidPtr(%in, 0);
- </native-to-target>
- <target-to-native>
- <add-conversion type="PyCObject">
- %out = *((%OUTTYPE*)PyCObject_AsVoidPtr(%in));
- </add-conversion>
- </target-to-native>
+ <native-to-target>
+ #ifdef IS_PY3K
+ return PyCapsule_New(%in, 0, 0);
+ #else
+ return PyCObject_FromVoidPtr(%in, 0);
+ #endif
+ </native-to-target>
+ <target-to-native>
+ <add-conversion type="PyNone">
+ %out = 0;
+ </add-conversion>
+ <add-conversion check="checkPyCapsuleOrPyCObject(%in)" type="PyObject">
+ #ifdef IS_PY3K
+ %out = (%OUTTYPE)PyCapsule_GetPointer(%in, 0);
+ #else
+ %out = (%OUTTYPE)PyCObject_AsVoidPtr(%in);
+ #endif
+ </add-conversion>
+ </target-to-native>
</conversion-rule>
</primitive-type>
<value-type name="POINT">