aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-05-02 15:51:05 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-05-04 14:12:14 +0000
commit8ed37563888f7956da99636c62f18459729d5966 (patch)
tree96f5acd1a0e3fdb23c6356766f32185f21e79a77 /sources/pyside2/PySide2
parenteda4418502a2c8c2f144ef690684f673ec7ebe24 (diff)
Use PyLong instead of PyInt for QVariant
Python 3 uses PyLong for integer manipulation, and since it is a valid type in Python 2 we can use it instead to have better compatibility, and avoid integer overflows. We keep the PyInt entry to avoid breaking other sections of the code when this type is required. Added a couple of PyInt_* alias to use PyLong_* ones instead. Task-number: PYSIDE-648 Change-Id: Id6af66050c5ab81fc51c1c07b1c9422a954b81c0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/PySide2')
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml5
1 files changed, 3 insertions, 2 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 598754fdd..403166d4a 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -394,8 +394,9 @@
double in = %CONVERTTOCPP[double](%in);
%out = %OUTTYPE(in);
</add-conversion>
- <add-conversion type="PyInt">
- int in = %CONVERTTOCPP[int](%in);
+ <!-- Using PyLong instead of PyInt to support Python2 and 3-->
+ <add-conversion type="PyInt" check="PyInt_CheckExact(%in)">
+ qlonglong in = %CONVERTTOCPP[qlonglong](%in);
%out = %OUTTYPE(in);
</add-conversion>
<add-conversion type="PyLong" check="PyLong_CheckExact(%in)">