[3.10] bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168) by miss-islington · Pull Request #30400 · python/cpython
done = {f for f in fs if f._state in [CANCELLED_AND_NOTIFIED, FINISHED]} not_done = fs - done if (return_when == FIRST_COMPLETED) and done: return DoneAndNotDoneFutures(done, not_done) elif (return_when == FIRST_EXCEPTION) and done:
done.update(waiter.finished_futures) return DoneAndNotDoneFutures(done, set(fs) - done) return DoneAndNotDoneFutures(done, fs - done)
class Future(object): """Represents the result of an asynchronous computation."""