summaryrefslogtreecommitdiff
path: root/py/runtime.c
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2020-11-30 16:40:56 +0100
committerDamien George <damien@micropython.org>2025-11-21 00:01:01 +1100
commit48d96b400e73e7fbcca8365d0bebc0c41402dde5 (patch)
treeb8c555c47655b4e939cd240f510365c1c4a4b269 /py/runtime.c
parentc07fda73f7115d2d2d4e2d4bba00a3e8dfd1367e (diff)
py/builtinimport: Support relative import in custom __import__ callback.
The globals need to be forwarded from the caller's context. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/runtime.c b/py/runtime.c
index a84e22760..ddc1ef7d3 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1522,7 +1522,7 @@ mp_obj_t mp_import_name(qstr name, mp_obj_t fromlist, mp_obj_t level) {
// build args array
mp_obj_t args[5];
args[0] = MP_OBJ_NEW_QSTR(name);
- args[1] = mp_const_none; // TODO should be globals
+ args[1] = MP_OBJ_FROM_PTR(mp_globals_get()); // globals of the current context
args[2] = mp_const_none; // TODO should be locals
args[3] = fromlist;
args[4] = level;