summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-10-16 19:40:14 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-10-16 19:40:14 (GMT)
commitb76444b2fa39a99984ffa4bcfa9806fbb091594a (patch)
treeda890788936c10c0ab6999339bd06ee11b9e3719 /Lib/idlelib
parent5c4e006367fcfb2cac3581080637976d0bd83921 (diff)
downloadcpython-b76444b2fa39a99984ffa4bcfa9806fbb091594a.zip
cpython-b76444b2fa39a99984ffa4bcfa9806fbb091594a.tar.gz
cpython-b76444b2fa39a99984ffa4bcfa9806fbb091594a.tar.bz2
use new showwarnings signature for idle #3391
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/PyShell.py12
-rw-r--r--Lib/idlelib/run.py5
2 files changed, 11 insertions, 6 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index a17f81f..c1b98a0 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -55,18 +55,22 @@ try:
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)
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 35a5031..abe94ab 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -25,11 +25,12 @@ except ImportError:
pass
else:
def idle_formatwarning_subproc(message, category, filename, lineno,
- line=None):
+ 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)