Mercurial > cpython-lru_cache-weakref
diff Lib/idlelib/PyShell.py @ 49520:d7a728420b03 2.6
Merged revisions 66922 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66922 | benjamin.peterson | 2008-10-16 14:40:14 -0500 (Thu, 16 Oct 2008) | 1 line
use new showwarnings signature for idle #3391
........
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Thu, 16 Oct 2008 19:46:25 +0000 |
| parents | b53604fad54b |
| children | db37af07d4c2 2cb0c52d779f |
line wrap: on
line diff
--- a/Lib/idlelib/PyShell.py Wed Oct 15 22:06:56 2008 +0000 +++ b/Lib/idlelib/PyShell.py Thu Oct 16 19:46:25 2008 +0000 @@ -55,18 +55,22 @@ except ImportError: pass else: - def idle_showwarning(message, category, filename, lineno): + def idle_showwarning(message, category, filename, lineno, + file=None, line=None): file = warning_stream try: - file.write(warnings.formatwarning(message, category, filename, lineno)) + file.write(warnings.formatwarning(message, category, filename,\ + lineno, file=file, line=line)) except IOError: pass ## file (probably __stderr__) is invalid, warning dropped. warnings.showwarning = idle_showwarning - def idle_formatwarning(message, category, filename, lineno): + def idle_formatwarning(message, category, filename, lineno, + file=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() + line = linecache.getline(filename, lineno).strip() \ + if line is None else line if line: s += " %s\n" % line s += "%s: %s\n>>> " % (category.__name__, message)
