From 0ab3fc3805282cc733bdf7a5970ec37e3160beee Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 21 Jan 2015 00:36:32 +0200 Subject: [PATCH] modffi: Support open own executable using open(None). --- unix/modffi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unix/modffi.c b/unix/modffi.c index fc218caf17..cf5d5eb2e1 100644 --- a/unix/modffi.c +++ b/unix/modffi.c @@ -272,7 +272,10 @@ STATIC mp_obj_t ffimod_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_ (void)n_args; (void)n_kw; - const char *fname = mp_obj_str_get_str(args[0]); + const char *fname = NULL; + if (args[0] != mp_const_none) { + fname = mp_obj_str_get_str(args[0]); + } void *mod = dlopen(fname, RTLD_NOW | RTLD_LOCAL); if (mod == NULL) {