diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2022-04-22 13:05:56 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-09-19 19:06:04 +1000 |
commit | e8355eb16357b0bd234a9bcab1c9e8b72fcdbabc (patch) | |
tree | 894b411f743d6d285f0ed34c6685e9a33818b1cf /py/objnamedtuple.h | |
parent | 5ddf671944465411f90bd0968550b719d0dbdb80 (diff) |
py/obj: Add "full" and "empty" non-variable-length mp_obj_type_t.
This will always have the maximum/minimum size of a mp_obj_type_t
representation and can be used as a member in other structs.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'py/objnamedtuple.h')
-rw-r--r-- | py/objnamedtuple.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/py/objnamedtuple.h b/py/objnamedtuple.h index d32af35af..9f23351d5 100644 --- a/py/objnamedtuple.h +++ b/py/objnamedtuple.h @@ -29,7 +29,10 @@ #include "py/objtuple.h" typedef struct _mp_obj_namedtuple_type_t { - mp_obj_type_t base; + // Must use the full-size version to avoid this being a variable sized member. + // This means that named tuples use slightly more RAM than necessary, but + // no worse than if we didn't have slots/split representation. + mp_obj_full_type_t base; size_t n_fields; qstr fields[]; } mp_obj_namedtuple_type_t; |