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

Method test_fromkeys_operator_modifying_set_operand

Lib/test/test_dict.py:1310–1326  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1308 pass
1309
1310 def test_fromkeys_operator_modifying_set_operand(self):
1311 # test fix for seg fault reported in issue 27945 part 4b.
1312 class X(int):
1313 def __hash__(self):
1314 return 13
1315
1316 def __eq__(self, other):
1317 if len(d) > 1:
1318 d.clear()
1319 return False
1320
1321 d = {} # this is required to exist so that d can be constructed!
1322 d = {X(1), X(2)}
1323 try:
1324 dict.fromkeys(d) # shouldn't crash
1325 except RuntimeError: # implementation defined
1326 pass
1327
1328 def test_dictitems_contains_use_after_free(self):
1329 class X:

Callers

nothing calls this directly

Calls 2

XClass · 0.70
fromkeysMethod · 0.45

Tested by

no test coverage detected