← index #7957PR #6176
Related · high · value 0.607
QUERY · ISSUE

mp_obj_class_lookup error

openby heixiaomaopened 2021-11-01updated 2021-11-06

After I rebuilt, there was a problem running the example. I don't know why

assertion "mp_obj_is_dict_or_ordereddict(MP_OBJ_FROM_PTR(type->locals_dict))" failed: file "/home/hxm/Desktop/lv_micropython/py/objtype.c", line 156, function: mp_obj_class_lookup
CANDIDATE · PULL REQUEST

py: Support passing in an OrderedDict to type() as the locals.

mergedby dpgeorgeopened 2020-06-21updated 2020-06-24
py-core

Split off frm #6130, this PR adds support for passing in an OrderedDict for the locals of a new class, using type(name, bases, locals), where locals can now be an OrderedDict.

The changes here introduce a new helper mp_obj_is_dict_or_ordereddict() and update existing code to use it (which decreases code size in extmod/moductypes.c). The actual feature of using OrderedDict as class locals costs 0 bytes.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied