[New-bugs-announce] [issue33792] asyncio: how to set a "Proactor event loop" policy? Issue with asyncio.run()

STINNER Victor report at bugs.python.org
Thu Jun 7 06:02:04 EDT 2018


New submission from STINNER Victor <vstinner at redhat.com>:

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.

----------
components: asyncio
messages: 318919
nosy: asvetlov, vstinner, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: how to set a "Proactor event loop" policy? Issue with asyncio.run()
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33792>
_______________________________________


More information about the New-bugs-announce mailing list