Skip to content

Commit 44629a5

Browse files
fix mypy err
1 parent c496f80 commit 44629a5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

mypyc/primitives/dict_ops.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
ERR_NEG_INT,
2020
binary_op,
2121
custom_op,
22+
custom_primitive_op,
2223
function_op,
2324
load_address_op,
2425
method_op,
@@ -80,20 +81,21 @@
8081
error_kind=ERR_NEVER,
8182
)
8283

83-
# dict[key]
84-
exact_dict_get_item_op = custom_op(
84+
# dict[key] = value
85+
dict_get_item_op = method_op(
86+
name="__getitem__",
8587
arg_types=[dict_rprimitive, object_rprimitive],
8688
return_type=object_rprimitive,
87-
c_function_name="CPyDict_GetItemUnsafe",
89+
c_function_name="CPyDict_GetItem",
8890
error_kind=ERR_MAGIC,
8991
)
9092

91-
# dictsubclass[key]
92-
dict_get_item_op = method_op(
93-
name="__getitem__",
93+
# dict[key] = value (exact dict only, no subclasses)
94+
# NOTE: this is currently for internal use only, and not used for CallExpr specialization
95+
exact_dict_get_item_op = custom_primitive_op(
9496
arg_types=[dict_rprimitive, object_rprimitive],
9597
return_type=object_rprimitive,
96-
c_function_name="CPyDict_GetItem",
98+
c_function_name="CPyDict_GetItemUnsafe",
9799
error_kind=ERR_MAGIC,
98100
)
99101

0 commit comments

Comments
 (0)