mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
Issue #20367: Fix behavior of concurrent.futures.as_completed() for duplicate
arguments. Patch by Glenn Langford.
This commit is contained in:
parent
d1c85fd283
commit
b9915973f3
5 changed files with 17 additions and 3 deletions
|
@ -344,6 +344,13 @@ class AsCompletedTests:
|
|||
SUCCESSFUL_FUTURE]),
|
||||
completed_futures)
|
||||
|
||||
def test_duplicate_futures(self):
|
||||
# Issue 20367. Duplicate futures should not raise exceptions or give
|
||||
# duplicate responses.
|
||||
future1 = self.executor.submit(time.sleep, 2)
|
||||
completed = [f for f in futures.as_completed([future1,future1])]
|
||||
self.assertEqual(len(completed), 1)
|
||||
|
||||
|
||||
class ThreadPoolAsCompletedTests(ThreadPoolMixin, AsCompletedTests, unittest.TestCase):
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue