mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Fix issue #20367: concurrent.futures.as_completed() for duplicate arguments.
Patch by Glenn Langford.
This commit is contained in:
parent
252fd0c24b
commit
e6994ff6e3
4 changed files with 16 additions and 3 deletions
|
@ -350,6 +350,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