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>
This commit is contained in:
Jim Mussared
2022-04-22 13:05:56 +10:00
committed by Damien George
parent 5ddf671944
commit e8355eb163
15 changed files with 40 additions and 21 deletions

View File

@@ -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;