Rename `._error` -> `._remote_ctx_error`

ctx_result_consumption
Tyler Goodlet 2022-07-27 15:01:24 -04:00
parent 33b0e36ad6
commit 6120e99d7e
2 changed files with 7 additions and 7 deletions

View File

@ -199,8 +199,8 @@ async def _invoke(
except BaseExceptionGroup: except BaseExceptionGroup:
# if a context error was set then likely # if a context error was set then likely
# thei multierror was raised due to that # thei multierror was raised due to that
if ctx._error is not None: if ctx._remote_ctx_error is not None:
raise ctx._error from None raise ctx._remote_ctx_error from None
raise raise

View File

@ -342,8 +342,8 @@ class MsgStream(trio.abc.Channel):
Send a message over this stream to the far end. Send a message over this stream to the far end.
''' '''
if self._ctx._error: if self._ctx._remote_ctx_error:
raise self._ctx._error # from None raise self._ctx._remote_ctx_error # from None
if self._closed: if self._closed:
raise trio.ClosedResourceError('This stream was already closed') raise trio.ClosedResourceError('This stream was already closed')
@ -385,7 +385,7 @@ class Context:
_portal: Optional[Portal] = None # type: ignore # noqa _portal: Optional[Portal] = None # type: ignore # noqa
_stream: Optional[MsgStream] = None _stream: Optional[MsgStream] = None
_result: Optional[Any] = False _result: Optional[Any] = False
_error: Optional[BaseException] = None _remote_ctx_error: Optional[BaseException] = None
# status flags # status flags
_cancel_called: bool = False _cancel_called: bool = False
@ -462,7 +462,7 @@ class Context:
f'{msg["error"]["tb_str"]}' f'{msg["error"]["tb_str"]}'
) )
self._error = error self._remote_ctx_error = error
# TODO: tempted to **not** do this by-reraising in a # TODO: tempted to **not** do this by-reraising in a
# nursery and instead cancel a surrounding scope, detect # nursery and instead cancel a surrounding scope, detect
@ -470,7 +470,7 @@ class Context:
if self._scope_nursery: if self._scope_nursery:
async def raiser(): async def raiser():
raise self._error from None raise self._remote_ctx_error from None
# from trio.testing import wait_all_tasks_blocked # from trio.testing import wait_all_tasks_blocked
# await wait_all_tasks_blocked() # await wait_all_tasks_blocked()