[issue22298] Lib/warnings.py _show_warning does not protect against being called with a file like object which is closed

Antoine Pitrou report at bugs.python.org
Sat Aug 30 10:27:52 CEST 2014


Antoine Pitrou added the comment:

This is not about stderr though, this is about the `file` argument that is passed to showwarning(). That stderr may be an invalid file is a rather rare condition, for good reason (even if you want to silence any program output, it is generally better to redirect stderr to /dev/null rather than make it an invalid or closed file).

It would be better to research why the original except clause was added than try to blindly extend it, IMO.

----------

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


More information about the Python-bugs-list mailing list