(facepalm) Reraise `BdbQuit` and discard ownerless lock releases

sigintsaviour_citesthackin
Tyler Goodlet 2022-01-22 20:05:24 -05:00
parent 3cac323421
commit 6b7b58346f
1 changed files with 12 additions and 3 deletions

View File

@ -454,7 +454,16 @@ async def _breakpoint(
global _local_pdb_complete, _debug_lock global _local_pdb_complete, _debug_lock
global _global_actor_in_debug, _local_task_in_debug 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 _global_actor_in_debug = None
_local_task_in_debug = None _local_task_in_debug = None
_local_pdb_complete.set() _local_pdb_complete.set()
@ -483,9 +492,9 @@ def _open_pdb() -> PdbwTeardown:
try: try:
yield pdb yield pdb
except: except bdb.BdbQuit:
# finally:
_pdb_release_hook() _pdb_release_hook()
raise
def disable_sigint_in_pdb(signum, frame, *args): def disable_sigint_in_pdb(signum, frame, *args):