title: Why does concurrent.futures executor map throw error when using with futures.as_completed after all the futures are complete?
body: <p>I am trying to send HTTP requests concurrently. In order to do so, I am using <a href="https://docs.python.org/3/library/concurrent.futures.html" rel="nofollow noreferrer">concurrent.futures</a></p>
  
  <p>Here is simple code:</p>
  
  <pre><code>import requests
  from concurrent import futures
  
  data = range(10)
  
  
  def send_request(item):
      requests.get("https://httpbin.org/ip")
      print("Request {} complete.".format(item))
  
  
  executor = futures.ThreadPoolExecutor(max_workers=25)
  
  futures_ = executor.map(send_request, data)
  
  for f in futures.as_completed(futures_):
      f.result()
  </code></pre>
  
  <p>If I run it, I can see requests are sent asynchronously, which is exactly what I want to do. However, when all the requests are complete, I get following error:</p>
  
  <pre><code>Request 0 complete.
  Request 6 complete.
  ...
  Request 7 complete.
  Request 9 complete.
  Request 3 complete.
  Traceback (most recent call last):
    File "send_thread.py", line 18, in &lt;module&gt;
      for f in futures.as_completed(futures_):
    File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/concurrent/futures/_base.py", line 219, in as_completed
      with _AcquireFutures(fs):
    File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/concurrent/futures/_base.py", line 146, in __enter__
      future._condition.acquire()
  AttributeError: 'NoneType' object has no attribute '_condition'
  </code></pre>
  
  <p>This is quite strange error. Here <code>executor.map</code> seems to be problematic. If I replace map with following line, it works as expected.</p>
  
  <pre><code>futures_ = [executor.submit(send_request, x) for x in data]
  </code></pre>
  
  <p>What am I missing? Tried to find difference between two, but can't seem to understand what could cause above issue. Any input would be highly appreciated.</p>