forked from goodboy/tractor
1
0
Fork 0

General typing fixes for `mypy`

signint_saviour
Tyler Goodlet 2022-07-11 09:42:26 -04:00
parent 4dcc21234e
commit b9eb601265
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)