py: Fix delete operation on map/dict and set objects.

Hash table can now be completely full (ie now NULL entry) before a
resize is triggered.  Use sentinel value to indicate delete entry in the
table.
This commit is contained in:
Damien George
2014-04-05 17:17:19 +01:00
parent e20b6b418c
commit 95004e5114
6 changed files with 191 additions and 81 deletions

View File

@@ -103,7 +103,7 @@ STATIC mp_map_elem_t *dict_it_iternext_elem(mp_obj_t self_in) {
mp_map_elem_t *table = self->dict->map.table;
for (int i = self->cur; i < max; i++) {
if (table[i].key != NULL) {
if (table[i].key != MP_OBJ_NULL && table[i].key != MP_OBJ_SENTINEL) {
self->cur = i + 1;
return &(table[i]);
}