py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them.

This allows customising the REPL prompt strings.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2021-07-27 00:43:35 +10:00
parent cac939ddc3
commit ac2293161e
15 changed files with 94 additions and 12 deletions

View File

@@ -135,6 +135,11 @@ void mp_init(void) {
MP_STATE_VM(sys_exitfunc) = mp_const_none;
#endif
#if MICROPY_PY_SYS_PS1_PS2
MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_PS1]) = MP_OBJ_NEW_QSTR(MP_QSTR__gt__gt__gt__space_);
MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_PS2]) = MP_OBJ_NEW_QSTR(MP_QSTR__dot__dot__dot__space_);
#endif
#if MICROPY_PY_SYS_SETTRACE
MP_STATE_THREAD(prof_trace_callback) = MP_OBJ_NULL;
MP_STATE_THREAD(prof_callback_is_executing) = false;