[docs] [issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

Jan-Philip Gehrcke report at bugs.python.org
Mon Feb 2 22:18:51 CET 2015


Jan-Philip Gehrcke added the comment:

For Python 3.5, I have attached a patch that 

    - adds relevant test cases to test_threading.py which probe
      the interpreter's stderr output for compliance with what
      the docs state.

    - makes sys.exit(msg) write msg to stderr, even if called
      from a non-primary thread, so that the tests succeed.

If we take this path, the documentation for 3.5 does not need to be adjusted.

The discussion in this thread diversified itself a bit:

> Why don't threads have their own ThreadExit exception,
> rather than overloading the use, and therefore, the 
> meaning, of the SystemExit exception? sys.exit and the
> SystemExit exception should *only* be used to exit the
> entire system, not just a thread!

While I absolutely agree that this would be conceptually cleaner, implementing this would be a larger refactoring task. Deciding whether this should be done or not slows this issue down, and I think this discussion should probably be taken elsewhere.

----------
versions: +Python 3.5 -Python 3.1, Python 3.2
Added file: http://bugs.python.org/file37986/issue6634_py35.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6634>
_______________________________________


More information about the docs mailing list