[Python-checkins] python/dist/src/Lib warnings.py,1.18,1.19

mhammond@users.sourceforge.net mhammond@users.sourceforge.net
Tue, 18 Feb 2003 16:33:36 -0800


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

Modified Files:
	warnings.py 
Log Message:
Fix bug 683658 - PyErr_Warn may cause import deadlock.


Index: warnings.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** warnings.py	14 Oct 2002 21:06:02 -0000	1.18
--- warnings.py	19 Feb 2003 00:33:33 -0000	1.19
***************
*** 1,5 ****
--- 1,9 ----
  """Python part of the warnings subsystem."""
  
+ # Note: function level imports should *not* be used
+ # in this module as it may cause import lock deadlock.
+ # See bug 683658.
  import sys, re, types
+ import linecache
  
  __all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
***************
*** 115,119 ****
  def formatwarning(message, category, filename, lineno):
      """Function to format a warning the standard way."""
-     import linecache
      s =  "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message)
      line = linecache.getline(filename, lineno).strip()
--- 119,122 ----