Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly use SelectorEventLoop on Windows #2737

Closed
ghost opened this issue Sep 3, 2019 · 3 comments
Closed

Explicitly use SelectorEventLoop on Windows #2737

ghost opened this issue Sep 3, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Sep 3, 2019

On Windows, Python 3.8's default event loop is now ProactorEventLoop. [1]
But tornado doesn't support ProactorEventLoop. [2]

Should we use SelectorEventLoop explicitly on Windows?

    if os.name == 'nt':
        import asyncio
        asyncio.DefaultEventLoopPolicy = asyncio.WindowsSelectorEventLoopPolicy

FYI, Python 3.8.0's release schedule: [3]

3.8.0 beta 4: Monday, 2019-08-26
3.8.0 candidate 1: Monday, 2019-09-30
3.8.0 candidate 2: Monday, 2019-10-07 (if necessary)
3.8.0 final: Monday, 2019-10-21

[1] https://docs.python.org/3.8/whatsnew/3.8.html#asyncio
[2] https://github.com/tornadoweb/tornado/blob/master/tornado/platform/asyncio.py#L15-L19
[3] https://www.python.org/dev/peps/pep-0569/#id6

@ghost
Copy link
Author

ghost commented Sep 3, 2019

In addition, we can catch NotImplementedError exception when invoking these functions, and prompt the user not to use ProactorEventLoop on Windows.
This is an optional idea.

class AbstractEventLoop:
    ....
    def add_reader(self, fd, callback, *args):
        raise NotImplementedError

    def remove_reader(self, fd):
        raise NotImplementedError

    def add_writer(self, fd, callback, *args):
        raise NotImplementedError

    def remove_writer(self, fd):
        raise NotImplementedError
    ....

above code from: https://github.com/python/cpython/blob/v3.8.0b4/Lib/asyncio/events.py#L500-L510

@ploxiln
Copy link
Contributor

ploxiln commented Sep 3, 2019

see #2608 and #2686

@ghost
Copy link
Author

ghost commented Sep 4, 2019

Sorry, close as duplicated.

@ghost ghost closed this as completed Sep 4, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant