MCPcopy
hub / github.com/tornadoweb/tornado / future_set_exc_info

Function future_set_exc_info

tornado/concurrent.py:221–242  ·  view source on GitHub ↗

Set the given ``exc_info`` as the `Future`'s exception. Understands both `asyncio.Future` and the extensions in older versions of Tornado to enable better tracebacks on Python 2. .. versionadded:: 5.0 .. versionchanged:: 6.0 If the future is already cancelled, this functio

(
    future: "Union[futures.Future[_T], Future[_T]]",
    exc_info: Tuple[
        Optional[type], Optional[BaseException], Optional[types.TracebackType]
    ],
)

Source from the content-addressed store, hash-verified

219
220
221def future_set_exc_info(
222 future: "Union[futures.Future[_T], Future[_T]]",
223 exc_info: Tuple[
224 Optional[type], Optional[BaseException], Optional[types.TracebackType]
225 ],
226) -> None:
227 """Set the given ``exc_info`` as the `Future`'s exception.
228
229 Understands both `asyncio.Future` and the extensions in older
230 versions of Tornado to enable better tracebacks on Python 2.
231
232 .. versionadded:: 5.0
233
234 .. versionchanged:: 6.0
235
236 If the future is already cancelled, this function is a no-op.
237 (previously ``asyncio.InvalidStateError`` would be raised)
238
239 """
240 if exc_info[1] is None:
241 raise Exception("future_set_exc_info called with no exception")
242 future_set_exception_unless_cancelled(future, exc_info[1])
243
244
245@typing.overload

Callers 9

wrapperFunction · 0.90
callbackFunction · 0.90
runMethod · 0.90
handle_yieldMethod · 0.90
handle_exceptionMethod · 0.90
runMethod · 0.90
errbackFunction · 0.90
submitMethod · 0.85
copyFunction · 0.85

Tested by

no test coverage detected