From 19b7f9c71a7952e45e014217b2c1cf470851f59a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 7 Mar 2023 17:37:36 -0500 Subject: [PATCH] Some more 3.10+ optional type sigs --- tractor/_debug.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tractor/_debug.py b/tractor/_debug.py index c3c3aed..1bf1e6e 100644 --- a/tractor/_debug.py +++ b/tractor/_debug.py @@ -750,8 +750,8 @@ def shield_sigint_handler( def _set_trace( - actor: Optional[tractor.Actor] = None, - pdb: Optional[MultiActorPdb] = None, + actor: tractor.Actor | None = None, + pdb: MultiActorPdb | None = None, ): __tracebackhide__ = True actor = actor or tractor.current_actor() @@ -761,7 +761,11 @@ def _set_trace( if frame: frame = frame.f_back # type: ignore - if frame and pdb and actor is not None: + if ( + frame + and pdb + and actor is not None + ): log.pdb(f"\nAttaching pdb to actor: {actor.uid}\n") # no f!#$&* idea, but when we're in async land # we need 2x frames up? @@ -770,7 +774,8 @@ def _set_trace( else: pdb, undo_sigint = mk_mpdb() - # we entered the global ``breakpoint()`` built-in from sync code? + # we entered the global ``breakpoint()`` built-in from sync + # code? Lock.local_task_in_debug = 'sync' pdb.set_trace(frame=frame)