Hide some portal stack layers in tracebacks

zombie_lord_infinite
Tyler Goodlet 2021-10-08 18:53:54 -04:00
parent 1b7cd419f2
commit 5df08aabb7
2 changed files with 11 additions and 8 deletions

View File

@ -65,16 +65,15 @@ def _trio_main(
parent_addr: Tuple[str, int] = None, parent_addr: Tuple[str, int] = None,
infect_asyncio: bool = False, infect_asyncio: bool = False,
) -> None: ) -> None:
"""Entry point for a `trio_run_in_process` subactor.
""" """
# Disable sigint handling in children; Entry point for a `trio_run_in_process` subactor.
# we don't need it thanks to our cancellation machinery.
"""
log.info(f"Started new trio process for {actor.uid}")
# Disable sigint handling in children?
# signal.signal(signal.SIGINT, signal.SIG_IGN) # signal.signal(signal.SIGINT, signal.SIG_IGN)
log.info(f"Started new trio process for {actor.uid}")
log.info(f"Started new trio process for {actor.uid}")
if actor.loglevel is not None: if actor.loglevel is not None:
log.info( log.info(
f"Setting loglevel for {actor.uid} to {actor.loglevel}") f"Setting loglevel for {actor.uid} to {actor.loglevel}")

View File

@ -129,6 +129,7 @@ class Portal:
resptype: str, resptype: str,
first_msg: dict first_msg: dict
) -> Any: ) -> Any:
__tracebackhide__ = True
assert resptype == 'asyncfunc' # single response assert resptype == 'asyncfunc' # single response
msg = await recv_chan.receive() msg = await recv_chan.receive()
@ -140,8 +141,11 @@ class Portal:
raise unpack_error(msg, self.channel) raise unpack_error(msg, self.channel)
async def result(self) -> Any: async def result(self) -> Any:
"""Return the result(s) from the remote actor's "main" task.
""" """
Return the result(s) from the remote actor's "main" task.
"""
__tracebackhide__ = True
# Check for non-rpc errors slapped on the # Check for non-rpc errors slapped on the
# channel for which we always raise # channel for which we always raise
exc = self.channel._exc exc = self.channel._exc