From cb7721611060adbc2983e2125df8841edf0765b4 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 22 Jan 2022 20:05:24 -0500 Subject: [PATCH] (facepalm) Reraise `BdbQuit` and discard ownerless lock releases --- tractor/_debug.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tractor/_debug.py b/tractor/_debug.py index 8e251ea..54e0e80 100644 --- a/tractor/_debug.py +++ b/tractor/_debug.py @@ -454,7 +454,16 @@ async def _breakpoint( global _local_pdb_complete, _debug_lock global _global_actor_in_debug, _local_task_in_debug - _debug_lock.release() + try: + _debug_lock.release() + except RuntimeError: + # uhhh makes no sense but been seeing the non-owner + # release error even though this is definitely the task + # that locked? + owner = _debug_lock.statistics().owner + if owner: + raise + _global_actor_in_debug = None _local_task_in_debug = None _local_pdb_complete.set() @@ -483,9 +492,9 @@ def _open_pdb() -> PdbwTeardown: try: yield pdb - except: - # finally: + except bdb.BdbQuit: _pdb_release_hook() + raise def disable_sigint_in_pdb(signum, frame, *args):