Kaydet (Commit) 289cae4f authored tarafından Victor Stinner's avatar Victor Stinner

(Merge 3.4) asyncio: Fix BaseEventLoop._assert_is_current_event_loop():

get_event_loop() raises an exception if there is no current loop
...@@ -332,8 +332,11 @@ class BaseEventLoop(events.AbstractEventLoop): ...@@ -332,8 +332,11 @@ class BaseEventLoop(events.AbstractEventLoop):
Should only be called when (self._debug == True). The caller is Should only be called when (self._debug == True). The caller is
responsible for checking this condition for performance reasons. responsible for checking this condition for performance reasons.
""" """
current = events.get_event_loop() try:
if current is not None and current is not self: current = events.get_event_loop()
except AssertionError:
return
if current is not self:
raise RuntimeError( raise RuntimeError(
"non-threadsafe operation invoked on an event loop other " "non-threadsafe operation invoked on an event loop other "
"than the current one") "than the current one")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment