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]
],
)
| 209 | |
| 210 | |
| 211 | def future_set_exc_info( |
| 212 | future: "Union[futures.Future[_T], Future[_T]]", |
| 213 | exc_info: Tuple[ |
| 214 | Optional[type], Optional[BaseException], Optional[types.TracebackType] |
| 215 | ], |
| 216 | ) -> None: |
| 217 | """Set the given ``exc_info`` as the `Future`'s exception. |
| 218 | |
| 219 | Understands both `asyncio.Future` and the extensions in older |
| 220 | versions of Tornado to enable better tracebacks on Python 2. |
| 221 | |
| 222 | .. versionadded:: 5.0 |
| 223 | |
| 224 | .. versionchanged:: 6.0 |
| 225 | |
| 226 | If the future is already cancelled, this function is a no-op. |
| 227 | (previously ``asyncio.InvalidStateError`` would be raised) |
| 228 | |
| 229 | """ |
| 230 | if exc_info[1] is None: |
| 231 | raise Exception("future_set_exc_info called with no exception") |
| 232 | future_set_exception_unless_cancelled(future, exc_info[1]) |
| 233 | |
| 234 | |
| 235 | @typing.overload |
no test coverage detected