Terry J. Reedy added the comment:

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

----------
resolution:  -> not a bug
stage: test needed -> resolved
status: open -> closed

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

Reply via email to