Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

The default handler writes the message of non-integer code to stderr, but in 
case of '--help', the message should be written to stdout. So this feature is 
not applicable for it. Are there other examples where this feature can be used?

In such cases it is better to write the message explicitly and call sys.exit() 
with the required exit code. For tests you can use contextlib.redirect_stderr() 
(or manually replace sys.stderr) to capture the stderr output.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36691>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to