Author terry.reedy
Recipients Arfrever, brett.cannon, kbk, r.david.murray, roger.serwy, terry.reedy, vinay.sajip
Date 2013-06-16.20:13:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I discovered the same thing a different way. Grepping Lib/*.py for
'Warning (from warnings module)' hits
F:\Python\dev\cpython\Lib\idlelib\ 67:
F:\Python\dev\cpython\Lib\idlelib\ 34:
Both monkey-patch warnings, when imported, to show warnings 'the Idle way' ;-). 

I am not sure which test file indirectly imports PyShell, but one must. Idle was written to be run from the command line. It was not written to be imported but not run, as in a test environment, or to be run as part of another script.

Roger, can the monkey patching be put in a function that is only called when Idle runs? Perhaps in PyShell.main and run.main? There is no need to reformat warning sent to the console (if there is one) during import, before Idle starts. Can the monkey-patching be undone when Python exits (in case it is being run from within a script)?

In the meanwhile, I will try using support.import_fresh_module('warnings') in test_logging, or better, saving and restoring warnings in test_idle.

[Although the alteration warnings are red-herrings for this issue, I am sure silencing them, including in tkinter tests, would be a good idea.]
Date User Action Args
2013-06-16 20:13:04terry.reedysetrecipients: + terry.reedy, brett.cannon, kbk, vinay.sajip, roger.serwy, Arfrever, r.david.murray
2013-06-16 20:13:04terry.reedysetmessageid: <>
2013-06-16 20:13:04terry.reedylinkissue18081 messages
2013-06-16 20:13:03terry.reedycreate