Skip to content

Commit deaeaac

Browse files
committed
modsys: Enable sys.exit() per port after all.
1 parent 37b0f33 commit deaeaac

4 files changed

Lines changed: 9 additions & 0 deletions

File tree

py/modsys.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ STATIC const MP_DEFINE_STR_OBJ(version_obj, "3.4.0");
5555

5656
STATIC const mp_map_elem_t mp_module_sys_globals_table[] = {
5757
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_sys) },
58+
#if MICROPY_SYS_EXIT
5859
// Should be implemented by port
5960
{ MP_OBJ_NEW_QSTR(MP_QSTR_exit), (mp_obj_t)&mp_sys_exit_obj },
61+
#endif
6062

6163
{ MP_OBJ_NEW_QSTR(MP_QSTR_path), (mp_obj_t)&mp_sys_path_obj },
6264
{ MP_OBJ_NEW_QSTR(MP_QSTR_argv), (mp_obj_t)&mp_sys_argv_obj },

py/mpconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ typedef double mp_float_t;
229229
#define MICROPY_MOD_SYS_STDFILES (0)
230230
#endif
231231

232+
// sys.exit() availability
233+
#ifndef MICROPY_SYS_EXIT
234+
#define MICROPY_SYS_EXIT (0)
235+
#endif
236+
232237
// Whether to support slice object and correspondingly
233238
// slice subscript operators
234239
#ifndef MICROPY_ENABLE_SLICE

stmhal/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#define MICROPY_ENABLE_LFN (1)
4646
#define MICROPY_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
4747
#define MICROPY_MOD_SYS_STDFILES (1)
48+
#define MICROPY_SYS_EXIT (1)
4849
#define MICROPY_ENABLE_MOD_CMATH (1)
4950

5051
// extra built in names to add to the global namespace

unix/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#define MICROPY_USE_COMPUTED_GOTO (1)
4545
#define MICROPY_MOD_SYS_STDFILES (1)
4646
#define MICROPY_ENABLE_MOD_CMATH (1)
47+
#define MICROPY_SYS_EXIT (1)
4748
// Define to MICROPY_ERROR_REPORTING_DETAILED to get function, etc.
4849
// names in exception messages (may require more RAM).
4950
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED)

0 commit comments

Comments
 (0)