Skip to content

Commit 34a4894

Browse files
committed
fix: Enums
1 parent dd6cded commit 34a4894

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mypyc/irbuild/builder.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
)
125125
from mypyc.irbuild.util import bytes_from_str, is_constant
126126
from mypyc.options import CompilerOptions
127-
from mypyc.primitives.dict_ops import true_dict_get_item_op, true_dict_set_item_op
127+
from mypyc.primitives.dict_ops import dict_set_item_op, true_dict_get_item_op, true_dict_set_item_op
128128
from mypyc.primitives.generic_ops import iter_op, next_op, py_setattr_op
129129
from mypyc.primitives.list_ops import list_get_item_unsafe_op, list_pop_last, to_list
130130
from mypyc.primitives.misc_ops import check_unpack_count_op, get_module_dict_op, import_op
@@ -431,7 +431,9 @@ def add_to_non_ext_dict(
431431
) -> None:
432432
# Add an attribute entry into the class dict of a non-extension class.
433433
key_unicode = self.load_str(key)
434-
self.primitive_op(true_dict_set_item_op, [non_ext.dict, key_unicode, val], line)
434+
# must use `dict_set_item_op` instead of `true_dict_set_item_op` because
435+
# it breaks enums, and probably other stuff, if we take the fast path.
436+
self.primitive_op(dict_set_item_op, [non_ext.dict, key_unicode, val], line)
435437

436438
def gen_import(self, id: str, line: int) -> None:
437439
self.imports[id] = None

0 commit comments

Comments
 (0)