Skip to content

Commit 5f12c5c

Browse files
committed
[Fix] deal with emptystruct and none
1 parent cf46710 commit 5f12c5c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mpython/core/base_types.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,15 @@ def from_any(cls, other, **kwargs):
4545
if "type__" in other:
4646
type__ = other["type__"]
4747

48-
if type__ == "structarray":
48+
if type__ == "none":
49+
# MPython returns this when catching a function
50+
# that should return no values but is asked for one.
51+
return None
52+
53+
elif type__ == "emptystruct":
54+
return Struct([])
55+
56+
elif type__ == "structarray":
4957
# MPython returns a list of dictionaries in data__
5058
# and the array shape in size__.
5159
return Struct._from_runtime(other)

0 commit comments

Comments
 (0)