Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-344

Pyside2 using the division and multiplication will return and change original value in release version

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.11.0
    • None
    • PySide
    • None
    • b31ae27fd0051e55ea27936495c5c6142063f8cd (shiboken/dev, 16.9.2016)

    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

        1. pyside344.py
          0.6 kB
        2. qmatrix4x4_wrapper.cpp
          133 kB
        3. valgrind_shiboken.sh
          2 kB

        Activity

          People

            kleint Friedemann Kleint
            chengxili Chengxi Li
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: