diff options
author | Guilherme Polo <ggpolo@gmail.com> | 2009-08-14 14:03:07 (GMT) |
---|---|---|
committer | Guilherme Polo <ggpolo@gmail.com> | 2009-08-14 14:03:07 (GMT) |
commit | f198ac2db28109c0761395b80c7b482f9167f515 (patch) | |
tree | a226fb4695ccba5f4af02fcc3c5754f3f977e92b /Lib/idlelib/run.py | |
parent | 86b882f3a6978cf359dfedcf1193bd930f024780 (diff) | |
download | cpython-f198ac2db28109c0761395b80c7b482f9167f515.zip cpython-f198ac2db28109c0761395b80c7b482f9167f515.tar.gz cpython-f198ac2db28109c0761395b80c7b482f9167f515.tar.bz2 |
Issue #3926: Fix the usage of the new showwarnings and formatwarning.
Diffstat (limited to 'Lib/idlelib/run.py')
-rw-r--r-- | Lib/idlelib/run.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 2d5c5ed..b5a6af3 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -25,12 +25,13 @@ except ImportError: pass else: def idle_formatwarning_subproc(message, category, filename, lineno, - file=None, line=None): + line=None): """Format warnings the IDLE way""" s = "\nWarning (from warnings module):\n" s += ' File \"%s\", line %s\n' % (filename, lineno) - line = linecache.getline(filename, lineno).strip() \ - if line is None else line + if line is None: + line = linecache.getline(filename, lineno) + line = line.strip() if line: s += " %s\n" % line s += "%s: %s\n" % (category.__name__, message) |