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]
],
)
| 219 | |
| 220 | |
| 221 | def 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 |
no test coverage detected