LCOV - code coverage report
Current view: top level - py - modsys.c (source / functions) Hit Total Coverage
Test: unix_coverage_v1.22.0-325-gd11ca092f.info Lines: 35 35 100.0 %
Date: 2024-04-17 08:48:33 Functions: 6 6 100.0 %
Branches: 6 6 100.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * This file is part of the MicroPython project, http://micropython.org/
       3                 :            :  *
       4                 :            :  * The MIT License (MIT)
       5                 :            :  *
       6                 :            :  * Copyright (c) 2013, 2014 Damien P. George
       7                 :            :  * Copyright (c) 2014-2017 Paul Sokolovsky
       8                 :            :  *
       9                 :            :  * Permission is hereby granted, free of charge, to any person obtaining a copy
      10                 :            :  * of this software and associated documentation files (the "Software"), to deal
      11                 :            :  * in the Software without restriction, including without limitation the rights
      12                 :            :  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      13                 :            :  * copies of the Software, and to permit persons to whom the Software is
      14                 :            :  * furnished to do so, subject to the following conditions:
      15                 :            :  *
      16                 :            :  * The above copyright notice and this permission notice shall be included in
      17                 :            :  * all copies or substantial portions of the Software.
      18                 :            :  *
      19                 :            :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      20                 :            :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      21                 :            :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      22                 :            :  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      23                 :            :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      24                 :            :  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      25                 :            :  * THE SOFTWARE.
      26                 :            :  */
      27                 :            : 
      28                 :            : #include "py/builtin.h"
      29                 :            : #include "py/objlist.h"
      30                 :            : #include "py/objmodule.h"
      31                 :            : #include "py/objtuple.h"
      32                 :            : #include "py/objstr.h"
      33                 :            : #include "py/objint.h"
      34                 :            : #include "py/objtype.h"
      35                 :            : #include "py/stream.h"
      36                 :            : #include "py/smallint.h"
      37                 :            : #include "py/runtime.h"
      38                 :            : #include "py/persistentcode.h"
      39                 :            : #include "extmod/modplatform.h"
      40                 :            : #include "genhdr/mpversion.h"
      41                 :            : 
      42                 :            : #if MICROPY_PY_SYS_SETTRACE
      43                 :            : #include "py/objmodule.h"
      44                 :            : #include "py/profile.h"
      45                 :            : #endif
      46                 :            : 
      47                 :            : #if MICROPY_PY_SYS
      48                 :            : 
      49                 :            : // defined per port; type of these is irrelevant, just need pointer
      50                 :            : extern struct _mp_dummy_t mp_sys_stdin_obj;
      51                 :            : extern struct _mp_dummy_t mp_sys_stdout_obj;
      52                 :            : extern struct _mp_dummy_t mp_sys_stderr_obj;
      53                 :            : 
      54                 :            : #if MICROPY_PY_IO && MICROPY_PY_SYS_STDFILES
      55                 :            : const mp_print_t mp_sys_stdout_print = {&mp_sys_stdout_obj, mp_stream_write_adaptor};
      56                 :            : #endif
      57                 :            : 
      58                 :            : // version - Python language version that this implementation conforms to, as a string
      59                 :            : static const MP_DEFINE_STR_OBJ(mp_sys_version_obj, "3.4.0; " MICROPY_BANNER_NAME_AND_VERSION);
      60                 :            : 
      61                 :            : // version_info - Python language version that this implementation conforms to, as a tuple of ints
      62                 :            : // TODO: CPython is now at 5-element array (major, minor, micro, releaselevel, serial), but save 2 els so far...
      63                 :            : static const mp_rom_obj_tuple_t mp_sys_version_info_obj = {{&mp_type_tuple}, 3, {MP_ROM_INT(3), MP_ROM_INT(4), MP_ROM_INT(0)}};
      64                 :            : 
      65                 :            : // sys.implementation object
      66                 :            : // this holds the MicroPython version
      67                 :            : static const mp_rom_obj_tuple_t mp_sys_implementation_version_info_obj = {
      68                 :            :     {&mp_type_tuple},
      69                 :            :     4,
      70                 :            :     {
      71                 :            :         MP_ROM_INT(MICROPY_VERSION_MAJOR),
      72                 :            :         MP_ROM_INT(MICROPY_VERSION_MINOR),
      73                 :            :         MP_ROM_INT(MICROPY_VERSION_MICRO),
      74                 :            :         #if MICROPY_VERSION_PRERELEASE
      75                 :            :         MP_ROM_QSTR(MP_QSTR_preview),
      76                 :            :         #else
      77                 :            :         MP_ROM_QSTR(MP_QSTR_),
      78                 :            :         #endif
      79                 :            :     }
      80                 :            : };
      81                 :            : static const MP_DEFINE_STR_OBJ(mp_sys_implementation_machine_obj, MICROPY_BANNER_MACHINE);
      82                 :            : #define SYS_IMPLEMENTATION_ELEMS_BASE \
      83                 :            :     MP_ROM_QSTR(MP_QSTR_micropython), \
      84                 :            :     MP_ROM_PTR(&mp_sys_implementation_version_info_obj), \
      85                 :            :     MP_ROM_PTR(&mp_sys_implementation_machine_obj)
      86                 :            : 
      87                 :            : #if MICROPY_PERSISTENT_CODE_LOAD
      88                 :            : #define SYS_IMPLEMENTATION_ELEMS__MPY \
      89                 :            :     , MP_ROM_INT(MPY_FILE_HEADER_INT)
      90                 :            : #else
      91                 :            : #define SYS_IMPLEMENTATION_ELEMS__MPY
      92                 :            : #endif
      93                 :            : 
      94                 :            : #if MICROPY_PY_ATTRTUPLE
      95                 :            : #if MICROPY_PREVIEW_VERSION_2
      96                 :            : #define SYS_IMPLEMENTATION_ELEMS__V2 \
      97                 :            :     , MP_ROM_TRUE
      98                 :            : #else
      99                 :            : #define SYS_IMPLEMENTATION_ELEMS__V2
     100                 :            : #endif
     101                 :            : 
     102                 :            : static const qstr impl_fields[] = {
     103                 :            :     MP_QSTR_name,
     104                 :            :     MP_QSTR_version,
     105                 :            :     MP_QSTR__machine,
     106                 :            :     #if MICROPY_PERSISTENT_CODE_LOAD
     107                 :            :     MP_QSTR__mpy,
     108                 :            :     #endif
     109                 :            :     #if MICROPY_PREVIEW_VERSION_2
     110                 :            :     MP_QSTR__v2,
     111                 :            :     #endif
     112                 :            : };
     113                 :            : static MP_DEFINE_ATTRTUPLE(
     114                 :            :     mp_sys_implementation_obj,
     115                 :            :     impl_fields,
     116                 :            :     3 + MICROPY_PERSISTENT_CODE_LOAD + MICROPY_PREVIEW_VERSION_2,
     117                 :            :     SYS_IMPLEMENTATION_ELEMS_BASE
     118                 :            :     SYS_IMPLEMENTATION_ELEMS__MPY
     119                 :            :     SYS_IMPLEMENTATION_ELEMS__V2
     120                 :            :     );
     121                 :            : #else
     122                 :            : static const mp_rom_obj_tuple_t mp_sys_implementation_obj = {
     123                 :            :     {&mp_type_tuple},
     124                 :            :     3 + MICROPY_PERSISTENT_CODE_LOAD,
     125                 :            :     // Do not include SYS_IMPLEMENTATION_ELEMS__V2 because
     126                 :            :     // SYS_IMPLEMENTATION_ELEMS__MPY may be empty if
     127                 :            :     // MICROPY_PERSISTENT_CODE_LOAD is disabled, which means they'll share
     128                 :            :     // the same index. Cannot query _v2 if MICROPY_PY_ATTRTUPLE is
     129                 :            :     // disabled.
     130                 :            :     {
     131                 :            :         SYS_IMPLEMENTATION_ELEMS_BASE
     132                 :            :                                 SYS_IMPLEMENTATION_ELEMS__MPY
     133                 :            :     }
     134                 :            : };
     135                 :            : #endif
     136                 :            : 
     137                 :            : #undef I
     138                 :            : 
     139                 :            : #ifdef MICROPY_PY_SYS_PLATFORM
     140                 :            : // platform - the platform that MicroPython is running on
     141                 :            : static const MP_DEFINE_STR_OBJ(mp_sys_platform_obj, MICROPY_PY_SYS_PLATFORM);
     142                 :            : #endif
     143                 :            : 
     144                 :            : #ifdef MICROPY_PY_SYS_EXECUTABLE
     145                 :            : // executable - the path to the micropython binary
     146                 :            : // This object is non-const and is populated at startup in main()
     147                 :            : MP_DEFINE_STR_OBJ(mp_sys_executable_obj, "");
     148                 :            : #endif
     149                 :            : 
     150                 :            : #if MICROPY_PY_SYS_INTERN
     151                 :            : MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_intern_obj, mp_obj_str_intern_checked);
     152                 :            : #endif
     153                 :            : 
     154                 :            : // exit([retval]): raise SystemExit, with optional argument given to the exception
     155                 :          8 : static mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) {
     156         [ +  + ]:          8 :     if (n_args == 0) {
     157                 :          4 :         mp_raise_type(&mp_type_SystemExit);
     158                 :            :     } else {
     159                 :          4 :         mp_raise_type_arg(&mp_type_SystemExit, args[0]);
     160                 :            :     }
     161                 :            : }
     162                 :            : MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit);
     163                 :            : 
     164                 :         27 : static mp_obj_t mp_sys_print_exception(size_t n_args, const mp_obj_t *args) {
     165                 :            :     #if MICROPY_PY_IO && MICROPY_PY_SYS_STDFILES
     166                 :         27 :     void *stream_obj = &mp_sys_stdout_obj;
     167         [ +  + ]:         27 :     if (n_args > 1) {
     168                 :         25 :         mp_get_stream_raise(args[1], MP_STREAM_OP_WRITE);
     169                 :         24 :         stream_obj = MP_OBJ_TO_PTR(args[1]);
     170                 :            :     }
     171                 :            : 
     172                 :         26 :     mp_print_t print = {stream_obj, mp_stream_write_adaptor};
     173                 :         26 :     mp_obj_print_exception(&print, args[0]);
     174                 :            :     #else
     175                 :            :     (void)n_args;
     176                 :            :     mp_obj_print_exception(&mp_plat_print, args[0]);
     177                 :            :     #endif
     178                 :            : 
     179                 :         26 :     return mp_const_none;
     180                 :            : }
     181                 :            : MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_print_exception_obj, 1, 2, mp_sys_print_exception);
     182                 :            : 
     183                 :            : #if MICROPY_PY_SYS_EXC_INFO
     184                 :          3 : static mp_obj_t mp_sys_exc_info(void) {
     185                 :          3 :     mp_obj_t cur_exc = MP_OBJ_FROM_PTR(MP_STATE_VM(cur_exception));
     186                 :          3 :     mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL));
     187                 :            : 
     188         [ +  + ]:          3 :     if (cur_exc == MP_OBJ_NULL) {
     189                 :          1 :         t->items[0] = mp_const_none;
     190                 :          1 :         t->items[1] = mp_const_none;
     191                 :          1 :         t->items[2] = mp_const_none;
     192                 :          1 :         return MP_OBJ_FROM_PTR(t);
     193                 :            :     }
     194                 :            : 
     195                 :          2 :     t->items[0] = MP_OBJ_FROM_PTR(mp_obj_get_type(cur_exc));
     196                 :          2 :     t->items[1] = cur_exc;
     197                 :          2 :     t->items[2] = mp_const_none;
     198                 :          2 :     return MP_OBJ_FROM_PTR(t);
     199                 :            : }
     200                 :            : MP_DEFINE_CONST_FUN_OBJ_0(mp_sys_exc_info_obj, mp_sys_exc_info);
     201                 :            : #endif
     202                 :            : 
     203                 :            : #if MICROPY_PY_SYS_GETSIZEOF
     204                 :         16 : static mp_obj_t mp_sys_getsizeof(mp_obj_t obj) {
     205                 :         16 :     return mp_unary_op(MP_UNARY_OP_SIZEOF, obj);
     206                 :            : }
     207                 :            : static MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_getsizeof_obj, mp_sys_getsizeof);
     208                 :            : #endif
     209                 :            : 
     210                 :            : #if MICROPY_PY_SYS_ATEXIT
     211                 :            : // atexit(callback): Callback is called when sys.exit is called.
     212                 :          2 : static mp_obj_t mp_sys_atexit(mp_obj_t obj) {
     213                 :          2 :     mp_obj_t old = MP_STATE_VM(sys_exitfunc);
     214                 :          2 :     MP_STATE_VM(sys_exitfunc) = obj;
     215                 :          2 :     return old;
     216                 :            : }
     217                 :            : static MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_atexit_obj, mp_sys_atexit);
     218                 :            : #endif
     219                 :            : 
     220                 :            : #if MICROPY_PY_SYS_SETTRACE
     221                 :            : // settrace(tracefunc): Set the system's trace function.
     222                 :            : static mp_obj_t mp_sys_settrace(mp_obj_t obj) {
     223                 :            :     return mp_prof_settrace(obj);
     224                 :            : }
     225                 :            : MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_settrace_obj, mp_sys_settrace);
     226                 :            : #endif // MICROPY_PY_SYS_SETTRACE
     227                 :            : 
     228                 :            : #if MICROPY_PY_SYS_PATH && !MICROPY_PY_SYS_ATTR_DELEGATION
     229                 :            : #error "MICROPY_PY_SYS_PATH requires MICROPY_PY_SYS_ATTR_DELEGATION"
     230                 :            : #endif
     231                 :            : 
     232                 :            : #if MICROPY_PY_SYS_PS1_PS2 && !MICROPY_PY_SYS_ATTR_DELEGATION
     233                 :            : #error "MICROPY_PY_SYS_PS1_PS2 requires MICROPY_PY_SYS_ATTR_DELEGATION"
     234                 :            : #endif
     235                 :            : 
     236                 :            : #if MICROPY_PY_SYS_TRACEBACKLIMIT && !MICROPY_PY_SYS_ATTR_DELEGATION
     237                 :            : #error "MICROPY_PY_SYS_TRACEBACKLIMIT requires MICROPY_PY_SYS_ATTR_DELEGATION"
     238                 :            : #endif
     239                 :            : 
     240                 :            : #if MICROPY_PY_SYS_ATTR_DELEGATION && !MICROPY_MODULE_ATTR_DELEGATION
     241                 :            : #error "MICROPY_PY_SYS_ATTR_DELEGATION requires MICROPY_MODULE_ATTR_DELEGATION"
     242                 :            : #endif
     243                 :            : 
     244                 :            : #if MICROPY_PY_SYS_ATTR_DELEGATION
     245                 :            : // Must be kept in sync with the enum at the top of mpstate.h.
     246                 :            : static const uint16_t sys_mutable_keys[] = {
     247                 :            :     #if MICROPY_PY_SYS_PATH
     248                 :            :     // Code should access this (as an mp_obj_t) for use with e.g.
     249                 :            :     // mp_obj_list_append by using the `mp_sys_path` macro defined in runtime.h.
     250                 :            :     MP_QSTR_path,
     251                 :            :     #endif
     252                 :            :     #if MICROPY_PY_SYS_PS1_PS2
     253                 :            :     MP_QSTR_ps1,
     254                 :            :     MP_QSTR_ps2,
     255                 :            :     #endif
     256                 :            :     #if MICROPY_PY_SYS_TRACEBACKLIMIT
     257                 :            :     MP_QSTR_tracebacklimit,
     258                 :            :     #endif
     259                 :            :     MP_QSTRnull,
     260                 :            : };
     261                 :            : 
     262                 :       5726 : void mp_module_sys_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
     263                 :       5726 :     MP_STATIC_ASSERT(MP_ARRAY_SIZE(sys_mutable_keys) == MP_SYS_MUTABLE_NUM + 1);
     264                 :       5726 :     MP_STATIC_ASSERT(MP_ARRAY_SIZE(MP_STATE_VM(sys_mutable)) == MP_SYS_MUTABLE_NUM);
     265                 :       5726 :     mp_module_generic_attr(attr, dest, sys_mutable_keys, MP_STATE_VM(sys_mutable));
     266                 :       5726 : }
     267                 :            : #endif
     268                 :            : 
     269                 :            : static const mp_rom_map_elem_t mp_module_sys_globals_table[] = {
     270                 :            :     { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sys) },
     271                 :            : 
     272                 :            :     #if MICROPY_PY_SYS_ARGV
     273                 :            :     { MP_ROM_QSTR(MP_QSTR_argv), MP_ROM_PTR(&MP_STATE_VM(mp_sys_argv_obj)) },
     274                 :            :     #endif
     275                 :            :     { MP_ROM_QSTR(MP_QSTR_version), MP_ROM_PTR(&mp_sys_version_obj) },
     276                 :            :     { MP_ROM_QSTR(MP_QSTR_version_info), MP_ROM_PTR(&mp_sys_version_info_obj) },
     277                 :            :     { MP_ROM_QSTR(MP_QSTR_implementation), MP_ROM_PTR(&mp_sys_implementation_obj) },
     278                 :            :     #ifdef MICROPY_PY_SYS_PLATFORM
     279                 :            :     { MP_ROM_QSTR(MP_QSTR_platform), MP_ROM_PTR(&mp_sys_platform_obj) },
     280                 :            :     #endif
     281                 :            :     #if MP_ENDIANNESS_LITTLE
     282                 :            :     { MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_QSTR(MP_QSTR_little) },
     283                 :            :     #else
     284                 :            :     { MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_QSTR(MP_QSTR_big) },
     285                 :            :     #endif
     286                 :            : 
     287                 :            :     #if MICROPY_PY_SYS_MAXSIZE
     288                 :            :     #if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
     289                 :            :     // Maximum mp_int_t value is not representable as small int, so we have
     290                 :            :     // little choice but to use MP_SMALL_INT_MAX. Apps also should be careful
     291                 :            :     // to not try to compare sys.maxsize to some literal number (as this
     292                 :            :     // number might not fit in available int size), but instead count number
     293                 :            :     // of "one" bits in sys.maxsize.
     294                 :            :     { MP_ROM_QSTR(MP_QSTR_maxsize), MP_ROM_INT(MP_SMALL_INT_MAX) },
     295                 :            :     #else
     296                 :            :     { MP_ROM_QSTR(MP_QSTR_maxsize), MP_ROM_PTR(&mp_sys_maxsize_obj) },
     297                 :            :     #endif
     298                 :            :     #endif
     299                 :            : 
     300                 :            :     #if MICROPY_PY_SYS_INTERN
     301                 :            :     { MP_ROM_QSTR(MP_QSTR_intern), MP_ROM_PTR(&mp_sys_intern_obj) },
     302                 :            :     #endif
     303                 :            : 
     304                 :            :     #if MICROPY_PY_SYS_EXIT
     305                 :            :     { MP_ROM_QSTR(MP_QSTR_exit), MP_ROM_PTR(&mp_sys_exit_obj) },
     306                 :            :     #endif
     307                 :            : 
     308                 :            :     #if MICROPY_PY_SYS_SETTRACE
     309                 :            :     { MP_ROM_QSTR(MP_QSTR_settrace), MP_ROM_PTR(&mp_sys_settrace_obj) },
     310                 :            :     #endif
     311                 :            : 
     312                 :            :     #if MICROPY_PY_SYS_STDFILES
     313                 :            :     { MP_ROM_QSTR(MP_QSTR_stdin), MP_ROM_PTR(&mp_sys_stdin_obj) },
     314                 :            :     { MP_ROM_QSTR(MP_QSTR_stdout), MP_ROM_PTR(&mp_sys_stdout_obj) },
     315                 :            :     { MP_ROM_QSTR(MP_QSTR_stderr), MP_ROM_PTR(&mp_sys_stderr_obj) },
     316                 :            :     #endif
     317                 :            : 
     318                 :            :     #if MICROPY_PY_SYS_MODULES
     319                 :            :     { MP_ROM_QSTR(MP_QSTR_modules), MP_ROM_PTR(&MP_STATE_VM(mp_loaded_modules_dict)) },
     320                 :            :     #endif
     321                 :            :     #if MICROPY_PY_SYS_EXC_INFO
     322                 :            :     { MP_ROM_QSTR(MP_QSTR_exc_info), MP_ROM_PTR(&mp_sys_exc_info_obj) },
     323                 :            :     #endif
     324                 :            :     #if MICROPY_PY_SYS_GETSIZEOF
     325                 :            :     { MP_ROM_QSTR(MP_QSTR_getsizeof), MP_ROM_PTR(&mp_sys_getsizeof_obj) },
     326                 :            :     #endif
     327                 :            : 
     328                 :            :     #if MICROPY_PY_SYS_EXECUTABLE
     329                 :            :     { MP_ROM_QSTR(MP_QSTR_executable), MP_ROM_PTR(&mp_sys_executable_obj) },
     330                 :            :     #endif
     331                 :            : 
     332                 :            :     /*
     333                 :            :      * Extensions to CPython
     334                 :            :      */
     335                 :            : 
     336                 :            :     { MP_ROM_QSTR(MP_QSTR_print_exception), MP_ROM_PTR(&mp_sys_print_exception_obj) },
     337                 :            :     #if MICROPY_PY_SYS_ATEXIT
     338                 :            :     { MP_ROM_QSTR(MP_QSTR_atexit), MP_ROM_PTR(&mp_sys_atexit_obj) },
     339                 :            :     #endif
     340                 :            : };
     341                 :            : 
     342                 :            : static MP_DEFINE_CONST_DICT(mp_module_sys_globals, mp_module_sys_globals_table);
     343                 :            : 
     344                 :            : const mp_obj_module_t mp_module_sys = {
     345                 :            :     .base = { &mp_type_module },
     346                 :            :     .globals = (mp_obj_dict_t *)&mp_module_sys_globals,
     347                 :            : };
     348                 :            : 
     349                 :            : // Unlike the other CPython-compatible modules, sys is not extensible from the
     350                 :            : // filesystem. We rely on it to work so that things like sys.path are always
     351                 :            : // available.
     352                 :            : MP_REGISTER_MODULE(MP_QSTR_sys, mp_module_sys);
     353                 :            : 
     354                 :            : #if MICROPY_PY_SYS_ARGV
     355                 :            : // Code should access this (as an mp_obj_t) for use with e.g.
     356                 :            : // mp_obj_list_append by using the `mp_sys_argv` macro defined in runtime.h.
     357                 :            : MP_REGISTER_ROOT_POINTER(mp_obj_list_t mp_sys_argv_obj);
     358                 :            : #endif
     359                 :            : 
     360                 :            : #if MICROPY_PY_SYS_EXC_INFO
     361                 :            : // current exception being handled, for sys.exc_info()
     362                 :            : MP_REGISTER_ROOT_POINTER(mp_obj_base_t * cur_exception);
     363                 :            : #endif
     364                 :            : 
     365                 :            : #if MICROPY_PY_SYS_ATEXIT
     366                 :            : // exposed through sys.atexit function
     367                 :            : MP_REGISTER_ROOT_POINTER(mp_obj_t sys_exitfunc);
     368                 :            : #endif
     369                 :            : 
     370                 :            : #if MICROPY_PY_SYS_ATTR_DELEGATION
     371                 :            : // Contains mutable sys attributes.
     372                 :            : MP_REGISTER_ROOT_POINTER(mp_obj_t sys_mutable[MP_SYS_MUTABLE_NUM]);
     373                 :            : MP_REGISTER_MODULE_DELEGATION(mp_module_sys, mp_module_sys_attr);
     374                 :            : #endif
     375                 :            : 
     376                 :            : #endif // MICROPY_PY_SYS

Generated by: LCOV version 1.15-5-g462f71d