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
# start 2 levels up in user code
frame: FrameType = sys._getframe()
frame: Optional[FrameType] = sys._getframe()
if frame:
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")
# no f!#$&* idea!
# no f!#$&* idea, but when we're in async land
# we need 2x frames up?
frame = frame.f_back
else:

View File

@ -307,7 +307,8 @@ async def new_proc(
proc: Optional[trio.Process] = None
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}")
@ -334,6 +335,9 @@ async def new_proc(
await proc.wait()
raise
# a sub-proc ref **must** exist now
assert proc
portal = Portal(chan)
actor_nursery._children[subactor.uid] = (
subactor, proc, portal)