py/modsys: Add optional sys.tracebacklimit attribute.

With behaviour as per CPython.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2021-07-27 00:41:27 +10:00
parent bc181550a4
commit cac939ddc3
10 changed files with 117 additions and 3 deletions

View File

@@ -141,6 +141,10 @@ void mp_init(void) {
MP_STATE_THREAD(current_code_state) = NULL;
#endif
#if MICROPY_PY_SYS_TRACEBACKLIMIT
MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_TRACEBACKLIMIT]) = MP_OBJ_NEW_SMALL_INT(1000);
#endif
#if MICROPY_PY_BLUETOOTH
MP_STATE_VM(bluetooth) = MP_OBJ_NULL;
#endif