diff options
Diffstat (limited to 'sources/shiboken2/tests/samplebinding/typesystem_sample.xml')
-rw-r--r-- | sources/shiboken2/tests/samplebinding/typesystem_sample.xml | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml index 3b74cb13b..e4963721b 100644 --- a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml +++ b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml @@ -101,23 +101,14 @@ <native-to-target> if (!%in) Py_RETURN_NONE; - #ifdef IS_PY3K - return PyCapsule_New(%in, 0, 0); - #else - return PyCObject_FromVoidPtr(%in, 0); - #endif + return PyCapsule_New(%in, nullptr, nullptr); </native-to-target> <target-to-native> <add-conversion type="PyNone"> %out = 0; </add-conversion> <add-conversion check="checkPyCapsuleOrPyCObject(%in)" type="PyObject"> - void* ptr; - #ifdef IS_PY3K - ptr = PyCapsule_GetPointer(%in, 0); - #else - ptr = PyCObject_AsVoidPtr(%in); - #endif + void *ptr = PyCapsule_GetPointer(%in, nullptr); %out = (%OUTTYPE)ptr; </add-conversion> </target-to-native> @@ -127,11 +118,7 @@ <inject-code class="native" position="beginning"> static bool checkPyCapsuleOrPyCObject(PyObject* pyObj) { - #ifdef IS_PY3K return PyCapsule_CheckExact(pyObj); - #else - return PyCObject_Check(pyObj); - #endif } </inject-code> @@ -139,20 +126,11 @@ <include file-name="handle.h" location="local"/> <conversion-rule> <native-to-target> - #ifdef IS_PY3K - return PyCapsule_New(&%in, 0, 0); - #else - return PyCObject_FromVoidPtr(&%in, 0); - #endif + return PyCapsule_New(&%in, nullptr, nullptr); </native-to-target> <target-to-native> <add-conversion check="checkPyCapsuleOrPyCObject(%in)" type="PyObject"> - void* ptr; - #ifdef IS_PY3K - ptr = PyCapsule_GetPointer(%in, 0); - #else - ptr = PyCObject_AsVoidPtr(%in); - #endif + void *ptr = PyCapsule_GetPointer(%in, nullptr); %out = *((%OUTTYPE*)ptr); </add-conversion> </target-to-native> |