We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent caa3ef2 commit 785f5e6Copy full SHA for 785f5e6
Lib/test/test_dict.py
@@ -1324,6 +1324,19 @@ def __eq__(self, other):
1324
d = {0: set()}
1325
(0, X()) in d.items()
1326
1327
+ def test_dict_contain_use_after_free(self):
1328
+ # bpo-40489
1329
+ class S(str):
1330
+ def __eq__(self, other):
1331
+ d.clear()
1332
+ return NotImplemented
1333
+
1334
+ def __hash__(self):
1335
+ return hash('test')
1336
1337
+ d = {S(): 'value'}
1338
+ self.assertFalse('test' in d)
1339
1340
def test_init_use_after_free(self):
1341
class X:
1342
def __hash__(self):
0 commit comments