From 080137961daef9a1b0fe1f37f54a820842728442 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 18 Jun 2016 01:31:57 +0300 Subject: [PATCH] extmod/modbtree: open(): Support "in-memory" database with filename=None. It's not really in-memory though, just uses anonymous temporary file on disk. --- extmod/modbtree.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extmod/modbtree.c b/extmod/modbtree.c index 345b4d1618..955dafa70e 100644 --- a/extmod/modbtree.c +++ b/extmod/modbtree.c @@ -244,7 +244,10 @@ STATIC mp_obj_t mod_btree_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t { MP_QSTR_server_side, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, }; - const char *fname = mp_obj_str_get_str(pos_args[0]); + const char *fname = NULL; + if (pos_args[0] != mp_const_none) { + fname = mp_obj_str_get_str(pos_args[0]); + } struct { mp_arg_val_t server_side;