Terry J. Reedy added the comment:

Here is a patch that looks much bigger than it really is. Idle was written 
before the warnings module, so the warnings system was conditioned on a 
successful warnings import. The test is no longer needed, and neither Vinay nor 
Victor repeated the test at the new location for the warnings.showwarning 
patch, within PyShell.main and run.main. I just deleted the test and dedented 
the indented blocks, which were, except for three lines, otherwise unchanged.

For run.py, I copied warnings.showwarnings and changed it to call 
idle_formatwarnings_subproc instead of (patched) warnings.formatwarnings. I 
then put the replacement of warnings.showwarnings in main after the sanity 
checks.

For PyShell.py, I made a similar change in showwarnings and the 
warnings.showwarnings replacement. I also added AttributeError to the print 
exception. At least on Windows, warning_stream = sys.__stderr__  is None when 
Idle is started normally, from an icon. But otherwise changing Idle to stop 
expecting a writable console is another issue.

----------
stage: needs patch -> commit review
Added file: http://bugs.python.org/file30708/issue18081-warn.diff

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

Reply via email to