summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/selector_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-12-26 20:07:52 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-12-26 20:07:52 (GMT)
commit956de691f8bfc379a1f1453e9a53661c92afa15e (patch)
treef4c53073127f3577386b8c728aa0fc08339e7b3f /Lib/asyncio/selector_events.py
parentd7ff5a5375cc23dff10f91696ac4895971c5850c (diff)
downloadcpython-956de691f8bfc379a1f1453e9a53661c92afa15e.zip
cpython-956de691f8bfc379a1f1453e9a53661c92afa15e.tar.gz
cpython-956de691f8bfc379a1f1453e9a53661c92afa15e.tar.bz2
Issue #22926: In debug mode, call_soon(), call_at() and call_later() methods of
asyncio.BaseEventLoop now use the identifier of the current thread to ensure that they are called from the thread running the event loop. Before, the get_event_loop() method was used to check the thread, and no exception was raised when the thread had no event loop. Now the methods always raise an exception in debug mode when called from the wrong thread. It should help to notice misusage of the API.
Diffstat (limited to 'Lib/asyncio/selector_events.py')
-rw-r--r--Lib/asyncio/selector_events.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index 7df8b86..a97709d 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -68,7 +68,7 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
address, waiter, extra)
def close(self):
- if self._running:
+ if self.is_running():
raise RuntimeError("Cannot close a running event loop")
if self.is_closed():
return