[Python-checkins] python/dist/src/Lib warnings.py,1.9.14.1,1.9.14.2

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Sat, 05 Oct 2002 20:18:36 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv20810

Modified Files:
      Tag: release22-maint
	warnings.py 
Log Message:
Backport 1.17:

Ignore IOError exceptions when writing the message.



Index: warnings.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v
retrieving revision 1.9.14.1
retrieving revision 1.9.14.2
diff -C2 -d -r1.9.14.1 -r1.9.14.2
*** warnings.py	18 Apr 2002 04:52:10 -0000	1.9.14.1
--- warnings.py	6 Oct 2002 03:18:34 -0000	1.9.14.2
***************
*** 99,103 ****
      if file is None:
          file = sys.stderr
!     file.write(formatwarning(message, category, filename, lineno))
  
  def formatwarning(message, category, filename, lineno):
--- 99,106 ----
      if file is None:
          file = sys.stderr
!     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):