From db962b8a0e1a8d7cdde0827cbc157c49ec9e86f9 Mon Sep 17 00:00:00 2001 From: vsakkas Date: Fri, 20 Nov 2020 22:28:36 +0200 Subject: [PATCH] Update dict clear error kind --- mypyc/primitives/dict_ops.py | 2 +- mypyc/test-data/run-dicts.test | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mypyc/primitives/dict_ops.py b/mypyc/primitives/dict_ops.py index 0b9fca6ea2c0..e40eb644c1e3 100644 --- a/mypyc/primitives/dict_ops.py +++ b/mypyc/primitives/dict_ops.py @@ -148,7 +148,7 @@ arg_types=[dict_rprimitive], return_type=void_rtype, c_function_name='CPyDict_Clear', - error_kind=ERR_NEVER) + error_kind=ERR_MAGIC) # list(dict.keys()) dict_keys_op = custom_op( diff --git a/mypyc/test-data/run-dicts.test b/mypyc/test-data/run-dicts.test index 66c8eb0e7cb3..651f72db2957 100644 --- a/mypyc/test-data/run-dicts.test +++ b/mypyc/test-data/run-dicts.test @@ -92,6 +92,7 @@ assert get_content(od) == ([3, 1], [4, 2], [(3, 4), (1, 2)]) assert get_content_set({1: 2}) == ({1}, {2}, {(1, 2)}) assert get_content_set(od) == ({1, 3}, {2, 4}, {(1, 2), (3, 4)}) +from collections import defaultdict d = {'a': 1, 'b': 2} d.clear() assert d == {}