diff options
author | Guido van Rossum <guido@python.org> | 1997-09-29 23:22:12 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-09-29 23:22:12 (GMT) |
commit | f15d15964b6ac3e5ff71894707fbcff48bec45b2 (patch) | |
tree | e0fccf5a3756b03f3f0b2a265c65a175ffe61f09 /Lib/pdb.py | |
parent | c90ad2103eb9aca14b7a910cbcdcd7b570f690ab (diff) | |
download | cpython-f15d15964b6ac3e5ff71894707fbcff48bec45b2.zip cpython-f15d15964b6ac3e5ff71894707fbcff48bec45b2.tar.gz cpython-f15d15964b6ac3e5ff71894707fbcff48bec45b2.tar.bz2 |
Use sys.exc_info() where needed.
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-x | Lib/pdb.py | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -80,10 +80,11 @@ class Pdb(bdb.Bdb, cmd.Cmd): code = compile(line + '\n', '<stdin>', 'single') exec code in globals, locals except: - if type(sys.exc_type) == type(''): - exc_type_name = sys.exc_type - else: exc_type_name = sys.exc_type.__name__ - print '***', exc_type_name + ':', sys.exc_value + t, v = sys.exc_info()[:2] + if type(t) == type(''): + exc_type_name = t + else: exc_type_name = t.__name__ + print '***', exc_type_name + ':', v # Command definitions, called by cmdloop() # The argument is the remaining string on the command line @@ -219,10 +220,11 @@ class Pdb(bdb.Bdb, cmd.Cmd): value = eval(arg, self.curframe.f_globals, \ self.curframe.f_locals) except: - if type(sys.exc_type) == type(''): - exc_type_name = sys.exc_type - else: exc_type_name = sys.exc_type.__name__ - print '***', exc_type_name + ':', `sys.exc_value` + t, v = sys.exc_info()[:2] + if type(t) == type(''): + exc_type_name = t + else: exc_type_name = t.__name__ + print '***', exc_type_name + ':', `v` return print `value` @@ -277,10 +279,11 @@ class Pdb(bdb.Bdb, cmd.Cmd): value = eval(arg, self.curframe.f_globals, \ self.curframe.f_locals) except: - if type(sys.exc_type) == type(''): - exc_type_name = sys.exc_type - else: exc_type_name = sys.exc_type.__name__ - print '***', exc_type_name + ':', `sys.exc_value` + t, v = sys.exc_info()[:2] + if type(t) == type(''): + exc_type_name = t + else: exc_type_name = t.__name__ + print '***', exc_type_name + ':', `v` return code = None # Is it a function? |