Skip to content

Commit

Permalink
Merge pull request #13668 from telamonian/fix-handling-of-bdbquit
Browse files Browse the repository at this point in the history
fix uncaught `BdbQuit` exceptions on ipdb `exit`
  • Loading branch information
Carreau committed May 3, 2022
2 parents d174614 + fc23598 commit 1893a8f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Expand Up @@ -28,5 +28,13 @@ __pycache__
.pytest_cache
.python-version
venv*/
.idea/
.mypy_cache/

# jetbrains ide stuff
*.iml
.idea/

# vscode ide stuff
*.code-workspace
.history
.vscode
1 change: 0 additions & 1 deletion IPython/core/debugger.py
Expand Up @@ -101,7 +101,6 @@
#
#*****************************************************************************

import bdb
import inspect
import linecache
import sys
Expand Down
6 changes: 6 additions & 0 deletions IPython/core/interactiveshell.py
Expand Up @@ -14,6 +14,7 @@
import abc
import ast
import atexit
import bdb
import builtins as builtin_mod
import dis
import functools
Expand Down Expand Up @@ -3403,6 +3404,11 @@ async def run_code(self, code_obj, result=None, *, async_=False):
result.error_in_exec = e
self.showtraceback(exception_only=True)
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
except bdb.BdbQuit:
etype, value, tb = sys.exc_info()
if result is not None:
result.error_in_exec = value
# the BdbQuit stops here
except self.custom_exceptions:
etype, value, tb = sys.exc_info()
if result is not None:
Expand Down

0 comments on commit 1893a8f

Please sign in to comment.