From f83b5a8c80a5275fd5c2b9093de210b1871d7516 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Mon, 5 May 2025 22:33:52 +0200 Subject: [PATCH] Berry `introspect.module()` failed to load modules in files (#23376) --- CHANGELOG.md | 1 + lib/libesp32/berry/src/be_module.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed74cc913..722f0b575 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file. - Berry `display.touch_update` wrongly applies resistive calibration (#23363) - NimBLE log_level definition conflict (#23366) - Matter and mDNS can be enabled at the same time (#23373) +- Berry `introspect.module()` failed to load modules in files ### Removed diff --git a/lib/libesp32/berry/src/be_module.c b/lib/libesp32/berry/src/be_module.c index f02b9dedb..7b638b4c5 100644 --- a/lib/libesp32/berry/src/be_module.c +++ b/lib/libesp32/berry/src/be_module.c @@ -132,10 +132,10 @@ static char* fixpath(bvm *vm, bstring *path, size_t *size) if (var_isclosure(func)) { base = str(cl->proto->source); /* get the source file path */ } else { - base = "/"; + base = ""; } #else - base = "/"; + base = ""; #endif split = be_splitpath(base); *size = split - base + (size_t)str_len(path) + SUFFIX_LEN; @@ -183,11 +183,14 @@ static int open_libfile(bvm *vm, char *path, size_t size) strcpy(path + size - SUFFIX_LEN, sfxs[idx]); res = open_script(vm, path); } while (idx++ < 2 && res == BE_IO_ERROR); - if (res == BE_IO_ERROR) { #if BE_USE_SHARED_LIB + if (res == BE_IO_ERROR) { strcpy(path + size - SUFFIX_LEN, DLL_SUFFIX); res = open_dllib(vm, path); + } #endif + if (res == BE_EXCEPTION) { + be_dumpexcept(vm); } be_free(vm, path, size); return res;