Details
Description
Pyside2 using the division and multiplication will return and change original value in release version.
Tested with latest revision build with Python 2.7.11
C:\Python27\python.exe setup.py build --ignore-git --qmake=C:\Qt\5.6\msvc2015_64\bin\qmake.exe --cmake="C:\Program Files (x86)\CMake\bin\cmake.exe" --jobs=9 --jom --verbose
from PySide2.QtGui import * from PySide2.QtCore import * vals = [QTransform(), QMatrix4x4(), QSize(1, 1), QSizeF(1, 1), QPoint(1, 1), QQuaternion(1, 1, 1, 1), QVector2D(1, 1), QVector3D(1, 1, 1), QVector4D(1, 1, 1, 1)] for a in vals: print(type(a)) print(" org: %r" % a) x = (a * 2) print(" mul: %r" % a) y = (a / 2) print(" div: %r" % a) print(" test x: %r %r" % (a == x, id(a) == id(x))) print(" test y: %r %r" % (a == y, id(a) == id(y)))
Test result:
<type 'PySide2.QtGui.QTransform'> org: PySide2.QtGui.QTransform(1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000) mul: PySide2.QtGui.QTransform(1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000) div: PySide2.QtGui.QTransform(0.500000, 0.000000, 0.000000, 0.000000, 0.500000, 0.000000, 0.000000, 0.000000, 0.500000) test x: False False test y: True True <type 'PySide2.QtGui.QMatrix4x4'> org: PySide2.QtGui.QMatrix4x4((1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)) mul: PySide2.QtGui.QMatrix4x4((1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)) div: PySide2.QtGui.QMatrix4x4((0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.5)) test x: False False test y: True True <type 'PySide2.QtCore.QSize'> org: PySide2.QtCore.QSize(1, 1) mul: PySide2.QtCore.QSize(2, 2) div: PySide2.QtCore.QSize(1, 1) test x: True True test y: True True <type 'PySide2.QtCore.QSizeF'> org: PySide2.QtCore.QSizeF(1.000000, 1.000000) mul: PySide2.QtCore.QSizeF(2.000000, 2.000000) div: PySide2.QtCore.QSizeF(1.000000, 1.000000) test x: True True test y: True True <type 'PySide2.QtCore.QPoint'> org: PySide2.QtCore.QPoint(1, 1) mul: PySide2.QtCore.QPoint(2, 2) div: PySide2.QtCore.QPoint(1, 1) test x: True True test y: True True <type 'PySide2.QtGui.QQuaternion'> org: PySide2.QtGui.QQuaternion(1.000000, 1.000000, 1.000000, 1.000000) mul: PySide2.QtGui.QQuaternion(1.000000, 1.000000, 1.000000, 1.000000) div: PySide2.QtGui.QQuaternion(0.500000, 0.500000, 0.500000, 0.500000) test x: False False test y: True True <type 'PySide2.QtGui.QVector2D'> org: PySide2.QtGui.QVector2D(1.000000, 1.000000) mul: PySide2.QtGui.QVector2D(1.000000, 1.000000) div: PySide2.QtGui.QVector2D(0.500000, 0.500000) test x: False False test y: True True <type 'PySide2.QtGui.QVector3D'> org: PySide2.QtGui.QVector3D(1.000000, 1.000000, 1.000000) mul: PySide2.QtGui.QVector3D(1.000000, 1.000000, 1.000000) div: PySide2.QtGui.QVector3D(0.500000, 0.500000, 0.500000) test x: False False test y: True True <type 'PySide2.QtGui.QVector4D'> org: PySide2.QtGui.QVector4D(1.000000, 1.000000, 1.000000, 1.000000) mul: PySide2.QtGui.QVector4D(1.000000, 1.000000, 1.000000, 1.000000) div: PySide2.QtGui.QVector4D(0.500000, 0.500000, 0.500000, 0.500000) test x: False False test y: True True
Fails are non-deterministic depending on build (pyside344.py):
Qt 5.6.2 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 5.3.1 20160413) FAILS: [QPoint*] [QPoint/] [QPointF*] [QPointF/] [QSize*] [QSize/] [QSizeF*] [QSizeF/] [QMargins*] [QMargins/] [QTransform*] [QMatrix4x4*] [QVector2D*] [QVector3D*] [QVector4D*] [QQuaternion*] Qt 5.6.2 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 5.3.1 20160413) FAILS: [QPoint*] [QPoint/] [QPointF*] [QPointF/] [QSize*] [QSize/] [QSizeF*] [QSizeF/] [QMargins*] [QMargins/] [QTransform/] [QMatrix4x4/] [QVector2D/] [QVector3D/] [QVector4D/] [QQuaternion/] Qt 5.6.2 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2015) FAILS: [QPoint/] [QSize/]
Attachments
For Gerrit Dashboard: PYSIDE-344 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
171058,2 | Fix error handling | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
171097,2 | Completely initialize members of EnumTypeEntry | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
171193,3 | Add test for PYSIDE-344 | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
171194,3 | Fix multiplication/division/remainder entries of PyNumberMethods | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |