diff options
| author | Angus Gratton <angus@redyak.com.au> | 2024-10-08 14:41:44 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-11-19 10:58:00 +1100 |
| commit | c5d74fe46876767cc43d7d23d949d0f7c3dcd6bd (patch) | |
| tree | 6c5a7f9bad617663a03cc32e8413412abdcd80d6 /docs | |
| parent | a23277e3b0400b6b5ca6ce3d88e3a38859754a4e (diff) | |
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>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/library/builtins.rst | 6 | ||||
| -rw-r--r-- | docs/library/sys.rst | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/docs/library/builtins.rst b/docs/library/builtins.rst index 88b1fbcfe..5956aea7a 100644 --- a/docs/library/builtins.rst +++ b/docs/library/builtins.rst @@ -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`. diff --git a/docs/library/sys.rst b/docs/library/sys.rst index 7b34a0e31..c72214c13 100644 --- a/docs/library/sys.rst +++ b/docs/library/sys.rst @@ -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 |
