diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-02 15:50:55 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-03 08:22:13 +0000 |
commit | a5848518433a7adf1ca83b19441a1abe6734d8a9 (patch) | |
tree | c88f23cebd3636399f4ee1f31acd8c3e6d561a40 /sources/shiboken2/tests/samplebinding/typesystem_sample.xml | |
parent | 9dd6617b0228d5aa35bd7747560161a3f28c9c47 (diff) |
Remove Python2 from C++ code
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: I7e4ffaeabb2ac8a5ffe165d43b3475a7e5d57447
Reviewed-by: Christian Tismer <tismer@stackless.com>
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 a1f8cd6d1..86a626fcb 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> |