You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
asyncio: how to set a "Proactor event loop" policy? Issue with asyncio.run() #77973
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2018-06-08.03:43:15.087>created_at=<Date2018-06-07.10:02:04.335>labels= ['3.7', '3.8', 'expert-asyncio']
title='asyncio: how to set a "Proactor event loop" policy? Issue with asyncio.run()'updated_at=<Date2018-06-08.03:43:15.086>user='https://github.com/vstinner'
But this code doesn't work with asyncio.run() which creates a new event loop with the current policy, and the default policy on Windows is to use SelectorEventLoop.
I cannot find a "Proactor event loop policy" in asyncio, nor how to change the default policy to use Proactor event loop.
The workaround is to not use asyncio.run() which has been added in Python 3.7.
Activity
vstinner commentedon Jun 7, 2018
asyncio documentation suggets to use:
---
https://docs.python.org/dev/library/asyncio-eventloops.html
But this code doesn't work with asyncio.run() which creates a new event loop with the current policy, and the default policy on Windows is to use SelectorEventLoop.
I cannot find a "Proactor event loop policy" in asyncio, nor how to change the default policy to use Proactor event loop.
The workaround is to not use asyncio.run() which has been added in Python 3.7.
vstinner commentedon Jun 7, 2018
Ugly workaround:
It uses a private attribute :-(
asvetlov commentedon Jun 7, 2018
Looks like we need a proactor policy class.
1st1 commentedon Jun 8, 2018
New changeset 8f40429 by Yury Selivanov in branch 'master':
bpo-33792: Add selector and proactor windows policies (GH-7487)
8f40429
miss-islington commentedon Jun 8, 2018
New changeset 0738443 by Miss Islington (bot) in branch '3.7':
bpo-33792: Add selector and proactor windows policies (GH-7487)
0738443