Skip to content

Commit

Permalink
py/obj.h: Clarify comments about mp_map_t is_fixed and is_ordered.
Browse files Browse the repository at this point in the history
Long ago, prior to 0ef01d0, fixed and
ordered maps were the same setting with the "table_is_fixed_array" member
of mp_map_t.  But these settings are actually independent, and it is
possible to have is_fixed=1, is_ordered=0 (although this can currently
only be done by tools/cc1).  So update the comments to reflect this.
  • Loading branch information
dpgeorge committed Jun 10, 2020
1 parent 95cbe6b commit f3062b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py/obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ typedef struct _mp_rom_map_elem_t {

typedef struct _mp_map_t {
size_t all_keys_are_qstrs : 1;
size_t is_fixed : 1; // a fixed array that can't be modified; must also be ordered
size_t is_ordered : 1; // an ordered array
size_t is_fixed : 1; // if set, table is fixed/read-only and can't be modified
size_t is_ordered : 1; // if set, table is an ordered array, not a hash map
size_t used : (8 * sizeof(size_t) - 3);
size_t alloc;
mp_map_elem_t *table;
Expand Down

0 comments on commit f3062b5

Please sign in to comment.