aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-03 12:26:28 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-03 15:40:05 +0200
commit157e03911ba0e2e8fd74899702588296693fd4ab (patch)
tree0844de0e12cc2de8f1634689190008a61460e88c /sources
parentd6f460db0f9fcdc2756b29209f21a7b87587881c (diff)
QByteArray::number(): suppress small integer types as is for setNum()
Otherwise, overflow errors can occur. Task-number: PYSIDE-904 Change-Id: I42486a27bcdb8e7562d411b4519d2e61f315be1d Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml8
-rw-r--r--sources/pyside2/tests/QtCore/qbytearray_test.py8
2 files changed, 15 insertions, 1 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 986356720..82b0a7ebe 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -2054,12 +2054,18 @@
<modify-function signature="operator>=(const char*,QByteArray)" remove="all"/>
<modify-function signature="operator[](int)const" remove="all"/>
<modify-function signature="operator[](uint)const" remove="all"/>
- <!-- Those types have the same representation in Python, an overload would be useless. -->
+ <!-- Those types have the same representation in Python, an overload
+ would be useless and cause overflow errors. -->
<modify-function signature="setNum(uint,int)" remove="all"/>
<modify-function signature="setNum(ushort,int)" remove="all"/>
<modify-function signature="setNum(float,char,int)" remove="all"/>
<modify-function signature="setNum(short,int)" remove="all"/>
<modify-function signature="setNum(qulonglong,int)" remove="all"/>
+ <modify-function signature="number(uint,int)" remove="all"/>
+ <modify-function signature="number(ushort,int)" remove="all"/>
+ <modify-function signature="number(float,char,int)" remove="all"/>
+ <modify-function signature="number(short,int)" remove="all"/>
+ <modify-function signature="number(qulonglong,int)" remove="all"/>
<!--### -->
diff --git a/sources/pyside2/tests/QtCore/qbytearray_test.py b/sources/pyside2/tests/QtCore/qbytearray_test.py
index 8f1c9c201..c17b7efb1 100644
--- a/sources/pyside2/tests/QtCore/qbytearray_test.py
+++ b/sources/pyside2/tests/QtCore/qbytearray_test.py
@@ -75,6 +75,14 @@ class QByteArrayTestToNumber(unittest.TestCase):
b.setNum(-0.5)
self.assertEqual(b, "-0.5")
+ def testNumber(self):
+ b = QByteArray.number(py3k.long(-124124))
+ self.assertEqual(b, "-124124")
+ b = QByteArray.number(-124124)
+ self.assertEqual(b, "-124124")
+ b = QByteArray.number(-0.5)
+ self.assertEqual(b, "-0.5")
+
def testAppend(self):
b = QByteArray()
b.append(py3k.b("A"))