Kaydet (Commit) 65e03cd7 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Backport 1.17:

Ignore IOError exceptions when writing the message.
üst a7ce6244
......@@ -98,7 +98,10 @@ def showwarning(message, category, filename, lineno, file=None):
"""Hook to write a warning to a file; replace if you like."""
if file is None:
file = sys.stderr
file.write(formatwarning(message, category, filename, lineno))
try:
file.write(formatwarning(message, category, filename, lineno))
except IOError:
pass # the file (probably stderr) is invalid - this warning gets lost.
def formatwarning(message, category, filename, lineno):
"""Function to format a warning the standard way."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment