docs/library: Note link between machine.soft_reset() and sys.exit().

This is currently an implementation detail of MicroPython rather than by
design.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
Angus Gratton
2024-10-08 14:41:44 +11:00
committed by Damien George
parent a23277e3b0
commit c5d74fe468
2 changed files with 10 additions and 1 deletions

View File

@@ -194,6 +194,12 @@ Exceptions
|see_cpython| `python:SystemExit`. |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 .. exception:: TypeError
|see_cpython| `python:TypeError`. |see_cpython| `python:TypeError`.

View File

@@ -12,9 +12,12 @@ Functions
.. function:: exit(retval=0, /) .. function:: exit(retval=0, /)
Terminate current program with a given exit code. Underlyingly, this 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`. 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) .. function:: atexit(func)
Register *func* to be called upon termination. *func* must be a callable Register *func* to be called upon termination. *func* must be a callable