asyncio: Fix get_event_loop() to call set_event_loop() when setting the loop. By Anthony Baire.

This commit is contained in:
Guido van Rossum 2013-11-27 10:37:13 -08:00
parent 1314ef73d0
commit cced076218
2 changed files with 17 additions and 1 deletions

View file

@ -360,7 +360,7 @@ class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy):
if (self._local._loop is None and
not self._local._set_called and
isinstance(threading.current_thread(), threading._MainThread)):
self._local._loop = self.new_event_loop()
self.set_event_loop(self.new_event_loop())
assert self._local._loop is not None, \
('There is no current event loop in thread %r.' %
threading.current_thread().name)