Author xiang.zhang
Recipients serhiy.storchaka, vstinner, xiang.zhang
Date 2016-09-17.15:25:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474125942.74.0.117565832141.issue28189@psf.upfronthosting.co.za>
In-reply-to
Content
Now, when compare errors raised during `in`, dict.keys(), dict.values() and set all propagate the errors. But dict.items() will swallow the errors(only key compare):

>>> class BadEq:
...     def __hash__(self):
...             return 7
...     def __eq__(self, other):
...             raise RuntimeError
... 
>>> k1, k2, v1, v2 = BadEq(), BadEq(), BadEq(), BadEq()
>>> d = {k1: v1}
>>> k2 in d.keys()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 5, in __eq__
RuntimeError
>>> v2 in d.values()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 5, in __eq__
RuntimeError
>>> k2 in {k1}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 5, in __eq__
RuntimeError
>>> (k2, v2) in d.items()
False
>>> (k2, v1) in d.items()
False

dictitems_contains.patch tries to fix this.
History
Date User Action Args
2016-09-17 15:25:42xiang.zhangsetrecipients: + xiang.zhang, vstinner, serhiy.storchaka
2016-09-17 15:25:42xiang.zhangsetmessageid: <1474125942.74.0.117565832141.issue28189@psf.upfronthosting.co.za>
2016-09-17 15:25:42xiang.zhanglinkissue28189 messages
2016-09-17 15:25:42xiang.zhangcreate