Skip to content

Commit

Permalink
Some more 3.10+ optional type sigs
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Apr 16, 2023
1 parent cf3e880 commit 6358a87
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tractor/_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,8 @@ def do_cancel():


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()
Expand All @@ -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?
Expand All @@ -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)
Expand Down

0 comments on commit 6358a87

Please sign in to comment.