Skip to content

Commit

Permalink
docs/library: Note link between machine.soft_reset() and sys.exit().
Browse files Browse the repository at this point in the history
This is currently an implementation detail of MicroPython rather than by
design.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
  • Loading branch information
projectgus authored and dpgeorge committed Nov 18, 2024
1 parent a23277e commit c5d74fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/library/builtins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ Exceptions

|see_cpython| `python:SystemExit`.

On non-embedded ports (i.e. Windows and Unix), an unhandled ``SystemExit``
exits the MicroPython process in a similar way to CPython.

On embedded ports, an unhandled ``SystemExit`` currently causes a
:ref:`soft_reset` of MicroPython.

.. exception:: TypeError

|see_cpython| `python:TypeError`.
Expand Down
5 changes: 4 additions & 1 deletion docs/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ Functions
.. function:: exit(retval=0, /)

Terminate current program with a given exit code. Underlyingly, this
function raise as `SystemExit` exception. If an argument is given, its
function raises a `SystemExit` exception. If an argument is given, its
value given as an argument to `SystemExit`.

On embedded ports (i.e. all ports but Windows and Unix), an unhandled
`SystemExit` currently causes a :ref:`soft_reset` of MicroPython.

.. function:: atexit(func)

Register *func* to be called upon termination. *func* must be a callable
Expand Down

0 comments on commit c5d74fe

Please sign in to comment.