Issue 33792: asyncio: how to set a "Proactor event loop" policy? Issue with asyncio.run() (original) (raw)
Issue33792
This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/77973
classification
Title: | asyncio: how to set a "Proactor event loop" policy? Issue with asyncio.run() | ||
---|---|---|---|
Type: | Stage: | resolved | |
Components: | asyncio | Versions: | Python 3.8, Python 3.7 |
process
Status: | closed | Resolution: | fixed |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | Nosy List: | asvetlov, miss-islington, vstinner, yselivanov | |
Priority: | normal | Keywords: | patch |
Created on 2018-06-07 10:02 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 7487 | merged | yselivanov,2018-06-07 16:39 | |
PR 7508 | merged | miss-islington,2018-06-08 00:45 |
Messages (5) | ||
---|---|---|
msg318919 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2018-06-07 10:02 |
asyncio documentation suggets to use: --- import asyncio, sys if sys.platform == 'win32': loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) --- 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. | ||
msg318924 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2018-06-07 10:45 |
Ugly workaround: policy = asyncio.get_event_loop_policy() policy._loop_factory = asyncio.ProactorEventLoop It uses a private attribute :-( | ||
msg318929 - (view) | Author: Andrew Svetlov (asvetlov) * ![]() |
Date: 2018-06-07 13:43 |
Looks like we need a proactor policy class. | ||
msg319002 - (view) | Author: Yury Selivanov (yselivanov) * ![]() |
Date: 2018-06-08 00:44 |
New changeset 8f4042964d5b0ddf5cdf87862db962ba64e3f64a by Yury Selivanov in branch 'master': bpo-33792: Add selector and proactor windows policies (GH-7487) https://github.com/python/cpython/commit/8f4042964d5b0ddf5cdf87862db962ba64e3f64a | ||
msg319004 - (view) | Author: miss-islington (miss-islington) | Date: 2018-06-08 01:31 |
New changeset 0738443a5b071a6bd2c18957a06cfe571a7314f2 by Miss Islington (bot) in branch '3.7': bpo-33792: Add selector and proactor windows policies (GH-7487) https://github.com/python/cpython/commit/0738443a5b071a6bd2c18957a06cfe571a7314f2 |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:01 | admin | set | github: 77973 |
2018-06-08 03:43:15 | yselivanov | set | status: open -> closedresolution: fixedstage: patch review -> resolved |
2018-06-08 01:31:52 | miss-islington | set | nosy: + miss-islingtonmessages: + |
2018-06-08 00:45:10 | miss-islington | set | pull_requests: + <pull%5Frequest7136> |
2018-06-08 00:44:59 | yselivanov | set | messages: + |
2018-06-07 16:39:11 | yselivanov | set | keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest7112> |
2018-06-07 13:43:06 | asvetlov | set | messages: + |
2018-06-07 10:45:20 | vstinner | set | messages: + |
2018-06-07 10:02:04 | vstinner | create |