diff --git a/Lib/bdb.py b/Lib/bdb.py index a5b580b3f38..15a80230b48 100644 --- a/Lib/bdb.py +++ b/Lib/bdb.py @@ -246,9 +246,10 @@ def runctx(self, cmd, globals, locals): self.reset() sys.settrace(self.trace_dispatch) try: - exec(cmd + '\n', globals, locals) - except BdbQuit: - pass + try: + exec(cmd + '\n', globals, locals) + except BdbQuit: + pass finally: self.quitting = 1 sys.settrace(None)