General typing fixes for `mypy`

sigintsaviour_citesthackin
Tyler Goodlet 2022-07-11 09:42:26 -04:00
parent c865d01e85
commit cdc7bf6549
2 changed files with 9 additions and 4 deletions

View File

@ -739,13 +739,14 @@ def _set_trace(
# last_f.f_globals['__tracebackhide__'] = True # last_f.f_globals['__tracebackhide__'] = True
# start 2 levels up in user code # start 2 levels up in user code
frame: FrameType = sys._getframe() frame: Optional[FrameType] = sys._getframe()
if frame: if frame:
frame = frame.f_back # type: ignore frame = frame.f_back # type: ignore
if 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") log.pdb(f"\nAttaching pdb to actor: {actor.uid}\n")
# no f!#$&* idea! # no f!#$&* idea, but when we're in async land
# we need 2x frames up?
frame = frame.f_back frame = frame.f_back
else: else:

View File

@ -307,7 +307,8 @@ async def new_proc(
proc: Optional[trio.Process] = None proc: Optional[trio.Process] = None
try: try:
try: try:
proc = await trio.lowlevel.open_process(spawn_cmd) # TODO: needs ``trio_typing`` patch?
proc = await trio.lowlevel.open_process(spawn_cmd) # type: ignore
log.runtime(f"Started {proc}") log.runtime(f"Started {proc}")
@ -334,6 +335,9 @@ async def new_proc(
await proc.wait() await proc.wait()
raise raise
# a sub-proc ref **must** exist now
assert proc
portal = Portal(chan) portal = Portal(chan)
actor_nursery._children[subactor.uid] = ( actor_nursery._children[subactor.uid] = (
subactor, proc, portal) subactor, proc, portal)