From ae326cbb9a3337c46bc5907c2544431b5e04e93e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 16 Oct 2023 15:45:34 -0400 Subject: [PATCH] Ignore kbis in `open_crash_handler()` by default --- tractor/devx/_debug.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tractor/devx/_debug.py b/tractor/devx/_debug.py index 561c387..06e6071 100644 --- a/tractor/devx/_debug.py +++ b/tractor/devx/_debug.py @@ -1041,15 +1041,19 @@ async def maybe_wait_for_debugger( # TODO: better naming and what additionals? -# - optional runtime plugging? -# - detection for sync vs. async code? -# - specialized REPL entry when in distributed mode? +# - [ ] optional runtime plugging? +# - [ ] detection for sync vs. async code? +# - [ ] specialized REPL entry when in distributed mode? +# - [x] allow ignoring kbi Bo @cm def open_crash_handler( catch: set[BaseException] = { Exception, BaseException, - } + }, + ignore: set[BaseException] = { + KeyboardInterrupt, + }, ): ''' Generic "post mortem" crash handler using `pdbp` REPL debugger. @@ -1064,8 +1068,11 @@ def open_crash_handler( ''' try: yield - except tuple(catch): - pdbp.xpm() + except tuple(catch) as err: + + if type(err) not in ignore: + pdbp.xpm() + raise