diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -240,9 +240,18 @@ particular, ``sys.exit("some error message")`` is a quick way to exit a program when an error occurs. - Since :func:`exit` ultimately "only" raises an exception, it will only exit - the process when called from the main thread, and the exception is not - intercepted. + .. note:: + + :func:`exit` only terminates the process when called from the main thread, + and when the :exc:`SystemExit` exception is not intercepted. If raised in + a non-primary thread, :exc:`SystemExit` is caught automatically and causes + the calling thread to exit silently (equal behavior to calling + :func:`thread.exit`). + + .. warning:: + + When called from a non-primary thread, :func:`exit` does not write to + stderr. .. data:: exitfunc