Skip to content

Commit 0801379

Browse files
committed
extmod/modbtree: open(): Support "in-memory" database with filename=None.
It's not really in-memory though, just uses anonymous temporary file on disk.
1 parent e9739e3 commit 0801379

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

extmod/modbtree.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ STATIC mp_obj_t mod_btree_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t
244244
{ MP_QSTR_server_side, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
245245
};
246246

247-
const char *fname = mp_obj_str_get_str(pos_args[0]);
247+
const char *fname = NULL;
248+
if (pos_args[0] != mp_const_none) {
249+
fname = mp_obj_str_get_str(pos_args[0]);
250+
}
248251

249252
struct {
250253
mp_arg_val_t server_side;

0 commit comments

Comments
 (0)