diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/opcode.py | 3 | ||||
-rw-r--r-- | Lib/test/test_dict.py | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/Lib/opcode.py b/Lib/opcode.py index 1df192b..3603bb4 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -238,6 +238,9 @@ _specialized_instructions = [ "BINARY_SUBSCR_LIST_INT", "BINARY_SUBSCR_TUPLE_INT", "BINARY_SUBSCR_DICT", + "STORE_SUBSCR_ADAPTIVE", + "STORE_SUBSCR_LIST_INT", + "STORE_SUBSCR_DICT", "CALL_FUNCTION_ADAPTIVE", "CALL_FUNCTION_BUILTIN_O", "CALL_FUNCTION_BUILTIN_FAST", diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 32ffd38..66f5d56 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -892,6 +892,14 @@ class DictTest(unittest.TestCase): gc.collect() self.assertTrue(gc.is_tracked(t), t) + def test_string_keys_can_track_values(self): + # Test that this doesn't leak. + for i in range(10): + d = {} + for j in range(10): + d[str(j)] = j + d["foo"] = d + @support.cpython_only def test_track_literals(self): # Test GC-optimization of dict literals |