Skip to content

Commit c5d74fe

Browse files
projectgusdpgeorge
authored andcommitted
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 <[email protected]>
1 parent a23277e commit c5d74fe

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/library/builtins.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ Exceptions
194194

195195
|see_cpython| `python:SystemExit`.
196196

197+
On non-embedded ports (i.e. Windows and Unix), an unhandled ``SystemExit``
198+
exits the MicroPython process in a similar way to CPython.
199+
200+
On embedded ports, an unhandled ``SystemExit`` currently causes a
201+
:ref:`soft_reset` of MicroPython.
202+
197203
.. exception:: TypeError
198204

199205
|see_cpython| `python:TypeError`.

docs/library/sys.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ Functions
1212
.. function:: exit(retval=0, /)
1313

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

18+
On embedded ports (i.e. all ports but Windows and Unix), an unhandled
19+
`SystemExit` currently causes a :ref:`soft_reset` of MicroPython.
20+
1821
.. function:: atexit(func)
1922

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

0 commit comments

Comments
 (0)