MCPcopy Index your code
hub / github.com/python/cpython / BadHash

Class BadHash

Lib/test/test_dict.py:182–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180 class Exc(Exception): pass
181
182 class BadHash(object):
183 fail = False
184 def __hash__(self):
185 if self.fail:
186 raise Exc()
187 else:
188 return 42
189
190 x = BadHash()
191 d[x] = 42

Callers 3

test_getitemMethod · 0.70
test_setdefaultMethod · 0.70
test_popMethod · 0.70

Calls

no outgoing calls

Tested by 3

test_getitemMethod · 0.56
test_setdefaultMethod · 0.56
test_popMethod · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…