asyncio, Tulip issue 171: BaseEventLoop.close() now raises an exception if the
event loop is running. You must first stop the event loop and then wait until
it stopped, before closing it.
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index 2f7f197..42d8b0b 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -247,7 +247,11 @@
This clears the queues and shuts down the executor,
but does not wait for the executor to finish.
+
+ The event loop must not be running.
"""
+ if self._running:
+ raise RuntimeError("cannot close a running event loop")
if self._closed:
return
self._closed = True