python / cpython

The Python programming language
https://www.python.org
Other
63.14k stars 30.23k forks source link

concurrent.futures.as_completed() no longer accepts arbitrary iterables #75822

Closed ambv closed 7 years ago

ambv commented 7 years ago
BPO 31641
Nosy @pitrou, @vstinner, @ned-deily, @ambv, @grzgrzgrz3
PRs
  • python/cpython#3830
  • python/cpython#3831
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = 'https://github.com/ambv' closed_at = created_at = labels = ['type-bug', '3.7'] title = 'concurrent.futures.as_completed() no longer accepts arbitrary iterables' updated_at = user = 'https://github.com/ambv' ``` bugs.python.org fields: ```python activity = actor = 'ned.deily' assignee = 'lukasz.langa' closed = True closed_date = closer = 'ned.deily' components = [] creation = creator = 'lukasz.langa' dependencies = [] files = [] hgrepos = [] issue_num = 31641 keywords = ['patch', '3.6regression'] message_count = 7.0 messages = ['303355', '303357', '303359', '303361', '303364', '303583', '303584'] nosy_count = 5.0 nosy_names = ['pitrou', 'vstinner', 'ned.deily', 'lukasz.langa', 'grzgrzgrz3'] pr_nums = ['3830', '3831'] priority = None resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue31641' versions = ['Python 3.6', 'Python 3.7'] ```

    ambv commented 7 years ago

    bpo-27144 introduced a regression for as_completed(): it used to accept arbitrary iterables but now requires sequences, otherwise raising an exception like:

    Traceback (most recent call last):
      File "sandcastle/worker/sandcastle_worker.py", line 1266, in get_work_item
      File "jupiter/jupiter_client.py", line 166, in acquireWork
      File "jupiter/jupiter_client.py", line 241, in _acquire_multiple_async
      File "jupiter/jupiter_client.py", line 336, in _wait_for_responses
      File "/usr/local/fbcode/gcc-5-glibc-2.23/lib/python3.6/concurrent/futures/_base.py", line 217, in as_completed
        total_futures = len(fs)
    TypeError: object of type 'map' has no len()

    Since as_completed() is a very popular function, we need to revert the behavior here.

    ned-deily commented 7 years ago

    Sounds like we need to get this fixed for 3.6.3 final which is scheduled for Monday (3 days). Or revert the previous fix.

    ambv commented 7 years ago

    New changeset 574562c5ddb2f0429aab9af762442e6f9a3f26ab by Łukasz Langa in branch 'master': bpo-31641: Allow arbitrary iterables in concurrent.futures.as_completed() (bpo-3830) https://github.com/python/cpython/commit/574562c5ddb2f0429aab9af762442e6f9a3f26ab

    ambv commented 7 years ago

    New changeset 9ef28b6ad3d5aff767e3d852499def8b5ae5ff5d by Łukasz Langa (Miss Islington (bot)) in branch '3.6': [3.6] bpo-31641: Allow arbitrary iterables in concurrent.futures.as_completed() (GH-3830) (bpo-3831) https://github.com/python/cpython/commit/9ef28b6ad3d5aff767e3d852499def8b5ae5ff5d

    ambv commented 7 years ago

    Fix is already landed in 3.6 and master.

    ned-deily commented 7 years ago

    New changeset 2e3fd03796528a9f88f79d38e1d890af153c8e61 by Ned Deily (Miss Islington (bot)) in branch '3.6': [3.6] bpo-31641: Allow arbitrary iterables in concurrent.futures.as_completed() (GH-3830) (bpo-3831) https://github.com/python/cpython/commit/2e3fd03796528a9f88f79d38e1d890af153c8e61

    ned-deily commented 7 years ago

    Cherry picked into 3.6.3 final -> closing