Author vinay.sajip
Recipients Arfrever, brett.cannon, kbk, r.david.murray, roger.serwy, terry.reedy, vinay.sajip
Date 2013-06-16.23:42:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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 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.
Date User Action Args
2013-06-16 23:42:46vinay.sajipsetrecipients: + vinay.sajip, brett.cannon, terry.reedy, kbk, roger.serwy, Arfrever, r.david.murray
2013-06-16 23:42:46vinay.sajipsetmessageid: <>
2013-06-16 23:42:46vinay.sajiplinkissue18081 messages
2013-06-16 23:42:46vinay.sajipcreate