Skip to content

Commit f5c30de

Browse files
committed
Fix conversion of large integers to quint64
Values in the range of 0x7FFFFFFFFFFFFFFF to 0xFFFFFFFFFFFFFFFF caused an OverflowError when converted to quint64
1 parent a6cbba2 commit f5c30de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PythonQtConversion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ quint64 PythonQtConv::PyObjGetULongLong(PyObject* val, bool strict, bool &ok) {
989989
} else
990990
#endif
991991
if (Py_TYPE(val) == &PyLong_Type) {
992-
d = PyLong_AsLongLong(val);
992+
d = PyLong_AsUnsignedLongLong(val);
993993
} else if (!strict) {
994994
if (PyObject_TypeCheck(val, &PyInt_Type)) {
995995
// support for derived int classes, e.g. for our enums
@@ -1003,7 +1003,7 @@ quint64 PythonQtConv::PyObjGetULongLong(PyObject* val, bool strict, bool &ok) {
10031003
} else {
10041004
PyErr_Clear();
10051005
// PyLong_AsLongLong will try conversion to an int if the object is not an int:
1006-
d = PyLong_AsLongLong(val);
1006+
d = PyLong_AsUnsignedLongLong(val);
10071007
if (PyErr_Occurred()) {
10081008
PyErr_Clear();
10091009
ok = false;

0 commit comments

Comments
 (0)