Close #14205: dict lookup raises a RuntimeError if the dict is modified during
a lookup.

"if you want to make a sandbox on top of CPython, you have to fix segfaults"
so let's fix segfaults!
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index d2740a3..15db51d 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -379,7 +379,7 @@
         x.fail = True
         self.assertRaises(Exc, d.pop, x)
 
-    def test_mutatingiteration(self):
+    def test_mutating_iteration(self):
         # changing dict size during iteration
         d = {}
         d[1] = 1
@@ -387,6 +387,26 @@
             for i in d:
                 d[i+1] = 1
 
+    def test_mutating_lookup(self):
+        # changing dict during a lookup
+        class NastyKey:
+            mutate_dict = None
+
+            def __hash__(self):
+                # hash collision!
+                return 1
+
+            def __eq__(self, other):
+                if self.mutate_dict:
+                    self.mutate_dict[self] = 1
+                return self == other
+
+        d = {}
+        d[NastyKey()] = 0
+        NastyKey.mutate_dict = d
+        with self.assertRaises(RuntimeError):
+            d[NastyKey()] = None
+
     def test_repr(self):
         d = {}
         self.assertEqual(repr(d), '{}')