From 7eb31f3fea8ade7877fa0a423f57f69936571660 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 17 Oct 2023 16:52:31 -0400 Subject: [PATCH] Runtime import `.get_root()` in stdin hijacker to avoid import cycle --- tractor/devx/_debug.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tractor/devx/_debug.py b/tractor/devx/_debug.py index 06e6071..e636e49 100644 --- a/tractor/devx/_debug.py +++ b/tractor/devx/_debug.py @@ -49,7 +49,6 @@ from trio_typing import ( ) from ..log import get_logger -from .._discovery import get_root from .._state import ( is_root_process, debug_mode, @@ -331,7 +330,7 @@ async def lock_tty_for_child( f'Actor {subactor_uid} is blocked from acquiring debug lock\n' f"remote task: {task_name}:{subactor_uid}" ) - ctx._enter_debugger_on_cancel = False + ctx._enter_debugger_on_cancel: bool = False await ctx.cancel(f'Debug lock blocked for {subactor_uid}') return 'pdb_lock_blocked' @@ -388,6 +387,8 @@ async def wait_for_parent_stdin_hijack( ``maybe_wait_for_debugger()``). ''' + from .._discovery import get_root + with trio.CancelScope(shield=True) as cs: Lock._debugger_request_cs = cs @@ -611,7 +612,7 @@ def _set_trace( pdb: MultiActorPdb | None = None, shield: bool = False, ): - __tracebackhide__ = True + __tracebackhide__: bool = True actor: tractor.Actor = actor or tractor.current_actor() # start 2 levels up in user code