This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wolma
Recipients Julius.Lehmann-Richter, brett.cannon, mhammond, pitrou, terry.reedy, wolma
Date 2016-11-25.09:58:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480067913.03.0.954619802003.issue22298@psf.upfronthosting.co.za>
In-reply-to
Content
Hi Julius,

I guess it's a question of control and responsibilities.
If you write a program that may issue warnings under some conditions, that program may, for example, be used with stderr redirected to a file. Now it is possible that file gets removed while your program is running, then, upon the next warning, the program would crash with an IOError. In effect, this would let external cirumstances that are not under control by the programmer escalate a non-critical warning message to a true exception. It's debatable whether that should be prevented or not, but that seems to be the decision that Mark Hammond made long ago.
If, OTOH, your program chooses to close sys.stderr, that is a deliberate decision and it's the programmers responsibility then not to try to write to it anymore. Suppressing the resulting ValueError would only hide the fact that due to a programming error no warnings can be issued anymore.
Not sure if this makes any sense to you or others, but that's how I came to think about this.
History
Date User Action Args
2016-11-25 09:58:33wolmasetrecipients: + wolma, mhammond, brett.cannon, terry.reedy, pitrou, Julius.Lehmann-Richter
2016-11-25 09:58:33wolmasetmessageid: <1480067913.03.0.954619802003.issue22298@psf.upfronthosting.co.za>
2016-11-25 09:58:33wolmalinkissue22298 messages
2016-11-25 09:58:32wolmacreate