Vinay Sajip added the comment:

I would change the reverted test_logging to add 
"print(logging._warnings_showwarning)" before the failing assertions. If this 
is bound to the original warnings.showwarning implementation, all should be 
well. If it points to e.g. idle_showwarning, you would expect to get a failure, 
as idle_showwarning formats warning messages differently from what 
warnings.showwarning is originally bound to.

I think the right fix is to take the approach that logging does: have 
PyShell.py grow a captureWarnings(bool) function which either captures the old 
values before setting idle_showwarning/idle_formatwarning or restores them, 
according to the Boolean passed in. The PyShell.captureWarnings(True) could be 
called from PyShell module-level code if a side-effect free import is 
unavoidable, but test_idle could call PyShell.captureWarnings(False) to put 
things back as they were. I would have thought you could avoid side-effects by 
having the PyShell.captureWarnings(True) called from somewhere in the code path 
followed from "if __name__ == '__main__'", or from test_idle code.

Re. Your side note - IIRC that skip of the NTEventLogHandler is expected, 
unless you install some win32 components which aren't shipped with stock Python 
(Mark Hammond's pywin32 project, available on SourceForge). They are shipped 
with other Python distributions, e.g. ActivePython.

----------

_______________________________________
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