Skip to content

Commit 0bda5c2

Browse files
committed
Fix handling of a SystemExit raised in normal pdb mode
1 parent 55adbcc commit 0bda5c2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Lib/pdb.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,13 +2788,14 @@ def do_run(self, arg):
27882788
do_restart = do_run
27892789

27902790
def _error_exc(self):
2791-
exc = sys.exception()
2792-
if isinstance(exc, SystemExit):
2791+
if self._interact_state and isinstance(sys.exception(), SystemExit):
27932792
# If we get a SystemExit in 'interact' mode, exit the REPL.
27942793
self._interact_state = None
2795-
super()._error_exc()
2796-
if isinstance(exc, SystemExit):
2794+
ret = super()._error_exc()
27972795
self.message("*exit from pdb interact command*")
2796+
return ret
2797+
else:
2798+
return super()._error_exc()
27982799

27992800
def default(self, line):
28002801
# Unlike Pdb, don't prompt for more lines of a multi-line command.

0 commit comments

Comments
 (0)