diff options
| author | stijn <stijn@ignitron.net> | 2023-12-04 15:54:59 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-12-15 11:43:39 +1100 |
| commit | 85c02166cacb8c2a8bc82f9802814ca72cbf6017 (patch) | |
| tree | ef19d9ed8905a2c03867182747944f99e314dff3 /py/modsys.c | |
| parent | 05d3b223011a88a10c806be866db8e0d29f1e348 (diff) | |
py/modsys: Implement optional sys.intern.
Signed-off-by: stijn <stijn@ignitron.net>
Diffstat (limited to 'py/modsys.c')
| -rw-r--r-- | py/modsys.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/py/modsys.c b/py/modsys.c index 12fa1101b..2af81046f 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -147,6 +147,10 @@ STATIC const MP_DEFINE_STR_OBJ(mp_sys_platform_obj, MICROPY_PY_SYS_PLATFORM); MP_DEFINE_STR_OBJ(mp_sys_executable_obj, ""); #endif +#if MICROPY_PY_SYS_INTERN +MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_intern_obj, mp_obj_str_intern_checked); +#endif + // exit([retval]): raise SystemExit, with optional argument given to the exception STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) { if (n_args == 0) { @@ -293,6 +297,10 @@ STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = { #endif #endif + #if MICROPY_PY_SYS_INTERN + { MP_ROM_QSTR(MP_QSTR_intern), MP_ROM_PTR(&mp_sys_intern_obj) }, + #endif + #if MICROPY_PY_SYS_EXIT { MP_ROM_QSTR(MP_QSTR_exit), MP_ROM_PTR(&mp_sys_exit_obj) }, #endif |
