Skip to content
Snippets Groups Projects
Commit e9739e33 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

extmod/modbtree: __getitem__() should raise KeyError for non-existing key.

parent cbffd0aa
Branches
No related tags found
No related merge requests found
......@@ -203,7 +203,7 @@ STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
key.data = (void*)mp_obj_str_get_data(index, &key.size);
int res = __bt_get(self->db, &key, &val, 0);
if (res == RET_SPECIAL) {
return mp_const_none;
nlr_raise(mp_obj_new_exception(&mp_type_KeyError));
}
CHECK_ERROR(res);
return mp_obj_new_bytes(val.data, val.size);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment