Details
Description
Attempting to use QDomElement.setAttribute() with a value other than uint or str results in an OverflowError from libshiboken. This happens with python 3.6, 3.7 and 3.8 on both MacOs Catalina, and Linux. Qt version is 5.14.2 in both cases.
The attached program demonstrates the problem. The console displays:
% ./pyside2_setattribute_demo.py
./pyside2_setattribute_demo.py:16: RuntimeWarning: libshiboken: Overflow: Value -123 exceeds limits of type [unsigned] "j" (4bytes).
myelem.setAttribute("attr2", -123.45) # OverflowError
Traceback (most recent call last):
File "./pyside2_setattribute_demo.py", line 16, in <module>
myelem.setAttribute("attr2", -123.45) # OverflowError
OverflowError
It looks like float values are (incorrectly) cast to an int, and then Shiboken casts the int to an unsigned int and fails.
Changing the PySide2 import to PyQt5 allows the script to work as intended.
Attachments
For Gerrit Dashboard: PYSIDE-1372 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
312713,2 | QDomElement: remove unnecesary setAttribute overloads | 5.15 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
313201,2 | WIP: shiboken2: Refactor primitive type lists in overload decisor | dev | pyside/pyside-setup | Status: ABANDONED | -2 | 0 |
313202,2 | WIP: shiboken2: Add dependencies for primitive types | 5.15 | pyside/pyside-setup | Status: ABANDONED | -2 | 0 |
313646,4 | shiboken2: Refactor primitive type lists in overload decisor | 5.15 | pyside/pyside-setup | Status: MERGED | +2 | 0 |