Copy state from a future to a concurrent.futures.Future.
(concurrent, source)
| 334 | |
| 335 | |
| 336 | def _set_concurrent_future_state(concurrent, source): |
| 337 | """Copy state from a future to a concurrent.futures.Future.""" |
| 338 | assert source.done() |
| 339 | if source.cancelled(): |
| 340 | concurrent.cancel() |
| 341 | if not concurrent.set_running_or_notify_cancel(): |
| 342 | return |
| 343 | exception = source.exception() |
| 344 | if exception is not None: |
| 345 | concurrent.set_exception(_convert_future_exc(exception)) |
| 346 | else: |
| 347 | result = source.result() |
| 348 | concurrent.set_result(result) |
| 349 | |
| 350 | |
| 351 | def _copy_future_state(source, dest): |
no test coverage detected