PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 1033 - QDialog.DialogCode instances and return value from QDialog.exec_ hash to different values
: QDialog.DialogCode instances and return value from QDialog.exec_ hash to diff...
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtGui
: 1.0.8
: All All
: P1 normal
Assigned To: Hugo Parente Lima
:
:
:
  Show dependency treegraph
 
Reported: 2011-10-25 02:31 EEST by Paul Bonser
Modified: 2011-11-29 21:28 EET (History)
10 users (show)

See Also:


Attachments
A small example that demonstrates the issue. (196 bytes, text/x-python-script)
2011-10-25 02:31 EEST, Paul Bonser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Bonser 2011-10-25 02:31:08 EEST
Created attachment 438 [details]
A small example that demonstrates the issue.

With the enum hashing changes that came with 1.0.8, one can no longer use
QDialog.Accept and QDialog.Reject (or any other enum values on other classes)
as dictionary keys and use the return value of QDialog.exec_ to index that
dictionary, because exec_ returns an integer which hashes to a different value
than the enum instances now.
Comment 1 Hugo Parente Lima 2011-10-25 16:47:00 EEST
Is a bit weird that different enums can have the same hashes, but on the other
hand you have a valid use case.

I think the decision of "fix" the enums hash was done thinking strictly on
language side of the problem, not on real world use cases. so IMO the old
behavior must back.

This is an one-line fix, I can paste here the patch if you need it before the
next release.
Comment 2 Robert Kern 2011-10-25 18:15:40 EEST
I feel your pain. The rule is that if two objects compare equal, they must have
the same hashes. It's a complete pain to support if you allow cross-type
comparisons. If you want the enum values to compare equal to their
corresponding integer values, then they must also have the same hash as the
integer values.
Comment 3 Hugo Parente Lima 2011-10-31 16:22:22 EET
Fixed in commit:

shiboken/82ea7fe5a9020f6ac47695c0f0f3e384db4ef617
Comment 4 Luciano Wolf 2011-11-29 21:28:43 EET
Released on PySide 1.0.9. Closing.