Message281703
In 3.6, the code in question is
def _showwarnmsg_impl(msg):
file = msg.file
if file is None:
file = sys.stderr
if file is None:
# sys.stderr is None when run with pythonw.exe:
# warnings get lost
return
text = _formatwarnmsg(msg)
try:
file.write(text)
except OSError:
# the file (probably stderr) is invalid - this warning gets lost.
pass
When the write is attempted, *file* is not None. It can either be sys.stderr or something else, successfully opened. If writing to sys.stderr fails, we properly should give up.
If writing to something else fails, I now think we should try to write an exception to stderr. So I thing the bug here, if any, is unconditionally passing. Perhaps the exception clause should be replaced (in a new issue) with something like
except (OSError, ValueError):
if msg.file is not sys.stderr:
raise |
|
Date |
User |
Action |
Args |
2016-11-25 11:33:14 | terry.reedy | set | recipients:
+ terry.reedy, mhammond, brett.cannon, pitrou, wolma, Julius.Lehmann-Richter |
2016-11-25 11:33:14 | terry.reedy | set | messageid: <1480073594.26.0.445070116625.issue22298@psf.upfronthosting.co.za> |
2016-11-25 11:33:14 | terry.reedy | link | issue22298 messages |
2016-11-25 11:33:14 | terry.reedy | create | |
|