From 035a0a2b6e5e3e6908927d3627887fbd581b7469 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 12 Oct 2015 21:49:03 +0100 Subject: py: Add support for _ in REPL to hold last computed value. Only available when MICROPY_CAN_OVERRIDE_BUILTINS is enabled. --- py/modbuiltins.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'py/modbuiltins.c') diff --git a/py/modbuiltins.c b/py/modbuiltins.c index 1f33ab75e..45fb3ffd9 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -416,6 +416,10 @@ STATIC mp_obj_t mp_builtin___repl_print__(mp_obj_t o) { mp_obj_print_helper(&mp_plat_print, o, PRINT_REPR); mp_print_str(&mp_plat_print, "\n"); #endif + #if MICROPY_CAN_OVERRIDE_BUILTINS + mp_obj_t dest[2] = {MP_OBJ_SENTINEL, o}; + mp_type_module.attr((mp_obj_t)&mp_module_builtins, MP_QSTR__, dest); + #endif } return mp_const_none; } -- cgit v1.2.3