summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-06-23 13:14:50 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-06-23 13:14:50 (GMT)
commit289cae4f929997bcfe9689c3e9dd7a3be5e5919f (patch)
tree99c2573dafb4da1bdd3fe59c91950d88839cc696 /Lib
parentef85df168ac4481d54ece0e7ba84ff7d48647e20 (diff)
parent751c7c0f2db30a8a29383ec105d200991c209fe8 (diff)
downloadcpython-289cae4f929997bcfe9689c3e9dd7a3be5e5919f.zip
cpython-289cae4f929997bcfe9689c3e9dd7a3be5e5919f.tar.gz
cpython-289cae4f929997bcfe9689c3e9dd7a3be5e5919f.tar.bz2
(Merge 3.4) asyncio: Fix BaseEventLoop._assert_is_current_event_loop():
get_event_loop() raises an exception if there is no current loop
Diffstat (limited to 'Lib')
-rw-r--r--Lib/asyncio/base_events.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index 42d8b0b..b127142 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -332,8 +332,11 @@ class BaseEventLoop(events.AbstractEventLoop):
Should only be called when (self._debug == True). The caller is
responsible for checking this condition for performance reasons.
"""
- current = events.get_event_loop()
- if current is not None and current is not self:
+ try:
+ current = events.get_event_loop()
+ except AssertionError:
+ return
+ if current is not self:
raise RuntimeError(
"non-threadsafe operation invoked on an event loop other "
"than the current one")