Ben Darnell <[email protected]> added the comment:
> From my understanding, there is no issue for Tornado itself. If Jupiter
> Notebook needs Tornado, Tornado needs selector event loop on Windows --
> Jupiter can install the proper loop.
Right. I'm just advocating for something that would make the transition
smoother than each project independently stumbling across this issue and adding
their own patch (and then fielding support issues from users who have ended up
with a combination of versions that doesn't quite work). This of course depends
on how many affected projects there are; I know Jupyter is the biggest but
they're not the only one.
There's no more direct way, but a thread that does select() should work. In
fact, ProactorEventLoop could simply spin up a SelectorEventLoop in another
thread when one of the FD methods is called, and proxy the callbacks back and
forth.
def add_reader(self, fd, callback, *args):
if not self.selector_started:
self.start_selector()
self.selector.call_soon(self.selector.add_reader, fd, lambda:
self.call_soon(callback, *args))
def start_selector(self):
self.selector = SelectorEventLoop()
def target():
asyncio.set_event_loop(self.selector)
self.selector.run_forever()
thread = threading.Thread(target=target)
thread.start()
# Clean shutdown is left as an exercise for the reader.
Unifying the two interfaces like this would be preferable to adding more
complexity for configuration IMHO.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37373>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com