Ben Darnell <ben.darn...@gmail.com> added the comment:

> It's even slightly easier for tornado, which can reasonably set the 
> proactor-wrapper policy at IOLoop start time, which means 
> `asyncio.get_event_loop()` returns a loop with add_reader. But pyzmq doesn't 
> get invoked until an event loop is already running.

That's not what I'm doing in Tornado; I don't change the policy or the result 
of get_event_loop. Instead, I call get_event_loop (only once) and wrap its 
result in AddThreadSelectorEventLoop. This works even while the event loop is 
already running (which is not an uncommon case; there is no expectation that 
you use tornado.ioloop.IOLoop.start instead of asyncio.EventLoop.run_forever). 

This relies on the fact that I already have my own thread-local lookup function 
to retrieve the wrapped event loop; an application that used the more typical 
asyncio patterns and relied on get_event_loop would indeed have difficulty with 
this pattern.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37373>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to