diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-05-18 11:20:33 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-05-18 12:20:17 +0200 |
commit | ef10f62e66a3f409d0077c36f3849c87f96950d2 (patch) | |
tree | d8bbc3809159b0f237a281f44f06929dbc85e13a | |
parent | 025d3bb1f491da2850bb3d44672229ee6c436afe (diff) |
PySide2: Fix conversion of quintptr
Ensure it is 64bit for 64bit systems.
Change-Id: I0b4d54f2568bd70288e184a5a2d8f31532fed157
Fixes: PYSIDE-1303
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | 4 | ||||
-rw-r--r-- | sources/pyside2/PySide2/glue/qtcore.cpp | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 53ab29382..26193a0aa 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -223,9 +223,9 @@ </primitive-type> <primitive-type name="quintptr" target-lang-api-name="PyLong"> <conversion-rule> - <native-to-target file="../glue/qtcore.cpp" snippet="return-pylong-unsigned"/> + <native-to-target file="../glue/qtcore.cpp" snippet="return-pylong-quintptr"/> <target-to-native> - <add-conversion type="PyLong" file="../glue/qtcore.cpp" snippet="conversion-pylong-unsigned"/> + <add-conversion type="PyLong" file="../glue/qtcore.cpp" snippet="conversion-pylong-quintptr"/> </target-to-native> </conversion-rule> </primitive-type> diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 834383679..111e324b9 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -1678,6 +1678,14 @@ Py_END_ALLOW_THREADS %out = %OUTTYPE(PyLong_AsUnsignedLong(%in)); // @snippet conversion-pylong-unsigned +// @snippet conversion-pylong-quintptr +#if defined(IS_PY3K) && QT_POINTER_SIZE == 8 +%out = %OUTTYPE(PyLong_AsUnsignedLongLong(%in)); +#else +%out = %OUTTYPE(PyLong_AsUnsignedLong(%in)); +#endif +// @snippet conversion-pylong-quintptr + // @snippet conversion-pyunicode #ifndef Py_LIMITED_API Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in); @@ -1870,6 +1878,14 @@ return PyLong_FromLong(%in); return PyLong_FromUnsignedLong(%in); // @snippet return-pylong-unsigned +// @snippet return-pylong-quintptr +#if defined(IS_PY3K) && QT_POINTER_SIZE == 8 +return PyLong_FromUnsignedLongLong(%in); +#else +return PyLong_FromUnsignedLong(%in); +#endif +// @snippet return-pylong-quintptr + // @snippet return-pyunicode QByteArray ba = %in.toUtf8(); return PyUnicode_FromStringAndSize(ba.constData(), ba.size()); |