diff options
author | Mark Hammond <mhammond@skippinet.com.au> | 2003-02-19 00:33:33 (GMT) |
---|---|---|
committer | Mark Hammond <mhammond@skippinet.com.au> | 2003-02-19 00:33:33 (GMT) |
commit | a43fd0c8996eec2bdd0ec59edc252cb4f4ff4436 (patch) | |
tree | a77757f7e42f4a6caa040e93d393215f54541d50 /Lib/warnings.py | |
parent | 4ccf3e14f017d7314bc9cbc44ad6a0eec417e437 (diff) | |
download | cpython-a43fd0c8996eec2bdd0ec59edc252cb4f4ff4436.zip cpython-a43fd0c8996eec2bdd0ec59edc252cb4f4ff4436.tar.gz cpython-a43fd0c8996eec2bdd0ec59edc252cb4f4ff4436.tar.bz2 |
Fix bug 683658 - PyErr_Warn may cause import deadlock.
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r-- | Lib/warnings.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py index 16ae331..bab007f 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -1,6 +1,10 @@ """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", "resetwarnings"] @@ -114,7 +118,6 @@ def showwarning(message, category, filename, lineno, file=None): 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() if line: |