Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
5.15.2, 6.2.0
-
None
-
python 3.9.6
-
-
9399408fd1e7e12215389a5bf96ae5e4ec38905b (pyside/pyside-setup/dev) 587b6d15411debf979f2e4e06372e596409eadda (pyside/pyside-setup/6.2) 0de9cda236715bf52b863ea14dc5d4fb824eae5b (pyside/tqtc-pyside-setup/5.15)
Description
When storing a combination of flag in a python variable, comparing the flag object to itself gives wrong results with the inequality operator (!=). Interestingly, this only fails with combinations (from my limited tests anyway). More interesting, if you store an equal flag value in a second variable and use that for comparison with the first variable, all is well.
Code to reproduce:
from PySide6 import QtCore if __name__ == '__main__': f = QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom print('f is f:', f is f) # True print('f == f:', f == f) # True print('f != f:', f != f) # True -> wrong g = QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom print('f == g:', f == g) # True print('f != g:', f != g) # False