summaryrefslogtreecommitdiffstats
path: root/Lib/lib-stdwin
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-02-27 13:13:40 (GMT)
committerGuido van Rossum <guido@python.org>1995-02-27 13:13:40 (GMT)
commit5e38b6fda1d4e2822ac72e1f643f251bd0f3175b (patch)
tree4a86a9f4be277dd15b9957a15d768a7b09966e3e /Lib/lib-stdwin
parent051ab123b465685e714668099c0a6dd86de5673b (diff)
downloadcpython-5e38b6fda1d4e2822ac72e1f643f251bd0f3175b.zip
cpython-5e38b6fda1d4e2822ac72e1f643f251bd0f3175b.tar.gz
cpython-5e38b6fda1d4e2822ac72e1f643f251bd0f3175b.tar.bz2
handle class exceptions; added runeval; made runctx obsolete
Diffstat (limited to 'Lib/lib-stdwin')
-rw-r--r--Lib/lib-stdwin/wdb.py19
-rw-r--r--Lib/lib-stdwin/wdbframewin.py5
2 files changed, 17 insertions, 7 deletions
diff --git a/Lib/lib-stdwin/wdb.py b/Lib/lib-stdwin/wdb.py
index 4018ab1..27bbe51 100644
--- a/Lib/lib-stdwin/wdb.py
+++ b/Lib/lib-stdwin/wdb.py
@@ -75,7 +75,10 @@ class Wdb(bdb.Bdb, basewin.BaseWindow): # Window debugger
# This function is called if an exception occurs,
# but only if we are to stop at or just below this level
frame.f_locals['__exception__'] = exc_type, exc_value
- self.settitle(exc_type + ': ' + repr.repr(exc_value))
+ if type(exc_type) == type(''):
+ exc_type_name = exc_type
+ else: exc_type_name = exc_type.__name__
+ self.settitle(exc_type_name + ': ' + repr.repr(exc_value))
stdwin.fleep()
self.interaction(frame, exc_traceback)
if not self.closed:
@@ -271,19 +274,23 @@ class Wdb(bdb.Bdb, basewin.BaseWindow): # Window debugger
# Simplified interface
-def run(statement):
+def run(statement, globals=None, locals=None):
x = Wdb()
- try: x.run(statement)
+ try: x.run(statement, globals, locals)
finally: x.close()
-def runctx(statement, globals, locals):
+def runeval(expression, globals=None, locals=None):
x = Wdb()
- try: x.runctx(statement, globals, locals)
+ try: return x.runeval(expression, globals, locals)
finally: x.close()
+def runctx(statement, globals, locals):
+ # B/W compatibility
+ run(statement, globals, locals)
+
def runcall(*args):
x = Wdb()
- try: apply(x.runcall, args)
+ try: return apply(x.runcall, args)
finally: x.close()
def set_trace():
diff --git a/Lib/lib-stdwin/wdbframewin.py b/Lib/lib-stdwin/wdbframewin.py
index 13bd173..7a0ff39 100644
--- a/Lib/lib-stdwin/wdbframewin.py
+++ b/Lib/lib-stdwin/wdbframewin.py
@@ -100,7 +100,10 @@ class FrameWindow(basewin.BaseWindow):
value = eval(expr, globals, locals)
output = repr.repr(value)
except:
- output = sys.exc_type + ': ' + `sys.exc_value`
+ if type(sys.exc_type) == type(''):
+ exc_type_name = sys.exc_type
+ else: exc_type_name = sys.exc_type.__name__
+ output = exc_type_name + ': ' + `sys.exc_value`
self.displaylist[1] = output
lh = stdwin.lineheight()
r = (-10, 0), (30000, 2*lh)