Internal helper to copy state from another Future. The other Future must be a concurrent.futures.Future.
(source, dest)
| 353 | |
| 354 | |
| 355 | def _copy_future_state(source, dest): |
| 356 | """Internal helper to copy state from another Future. |
| 357 | |
| 358 | The other Future must be a concurrent.futures.Future. |
| 359 | """ |
| 360 | if dest.cancelled(): |
| 361 | return |
| 362 | assert not dest.done() |
| 363 | done, cancelled, result, exception = source._get_snapshot() |
| 364 | assert done |
| 365 | if cancelled: |
| 366 | dest.cancel() |
| 367 | elif exception is not None: |
| 368 | dest.set_exception(_convert_future_exc(exception)) |
| 369 | else: |
| 370 | dest.set_result(result) |
| 371 | |
| 372 | def _chain_future(source, destination): |
| 373 | """Chain two futures so that when one completes, so does the other. |
searching dependent graphs…