[Python-checkins] Revert "bpo-34037, asyncio: add BaseEventLoop.wait_executor_on_close (GH-13786)" (#13802)

Łukasz Langa webhook-mailer at python.org
Tue Jun 4 07:03:37 EDT 2019

commit: 7f9a2ae78051877f4d966119e2fcd27ec77eda1d
branch: master
author: Łukasz Langa <lukasz at langa.pl>
committer: GitHub <noreply at github.com>
date: 2019-06-04T13:03:20+02:00

Revert "bpo-34037, asyncio: add BaseEventLoop.wait_executor_on_close (GH-13786)" (#13802)

This reverts commit 0f0a30f4da4b529e0f7df857b9f575b231b32758.

D Misc/NEWS.d/next/Library/2019-06-03-22-54-15.bpo-34037.fKNAbH.rst
M Doc/library/asyncio-eventloop.rst
M Lib/asyncio/base_events.py

diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index f75ca9a966b6..8673f84e9638 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -140,18 +140,12 @@ Running and stopping the loop
    The loop must not be running when this function is called.
    Any pending callbacks will be discarded.
-   This method clears all queues and shuts down the default executor. By
-   default, it waits for the default executor to finish. Set
-   *loop.wait_executor_on_close* to ``False`` to not wait for the executor.
+   This method clears all queues and shuts down the executor, but does
+   not wait for the executor to finish.
    This method is idempotent and irreversible.  No other methods
    should be called after the event loop is closed.
-   .. versionchanged:: 3.8
-      The method now waits for the default executor to finish by default.
-      Added *loop.wait_executor_on_close* attribute.
 .. coroutinemethod:: loop.shutdown_asyncgens()
    Schedule all currently open :term:`asynchronous generator` objects to
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index b1a7f88f4116..e0025397fa8a 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -380,8 +380,6 @@ def close(self):
 class BaseEventLoop(events.AbstractEventLoop):
     def __init__(self):
-        # If true, close() waits for the default executor to finish
-        self.wait_executor_on_close = True
         self._timer_cancelled_count = 0
         self._closed = False
         self._stopping = False
@@ -637,7 +635,7 @@ def close(self):
         executor = self._default_executor
         if executor is not None:
             self._default_executor = None
-            executor.shutdown(wait=self.wait_executor_on_close)
+            executor.shutdown(wait=False)
     def is_closed(self):
         """Returns True if the event loop was closed."""
diff --git a/Misc/NEWS.d/next/Library/2019-06-03-22-54-15.bpo-34037.fKNAbH.rst b/Misc/NEWS.d/next/Library/2019-06-03-22-54-15.bpo-34037.fKNAbH.rst
deleted file mode 100644
index fb2f7a5fa36e..000000000000
--- a/Misc/NEWS.d/next/Library/2019-06-03-22-54-15.bpo-34037.fKNAbH.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-:mod:`asyncio`: ``loop.close()`` now waits for the default executor to
-finish by default. Set ``loop.wait_executor_on_close`` attribute to
-``False`` to opt-in for Python 3.7 behavior (not wait for the executor to

More information about the Python-checkins mailing list