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

2018-06-07 Thread Yury Selivanov


Change by Yury Selivanov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2018-06-07 Thread miss-islington


miss-islington  added the comment:


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


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2018-06-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7136

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2018-06-07 Thread Yury Selivanov


Yury Selivanov  added the comment:


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


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2018-06-07 Thread Yury Selivanov


Change by Yury Selivanov :


--
keywords: +patch
pull_requests: +7112
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2018-06-07 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Looks like we need a proactor policy class.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2018-06-07 Thread STINNER Victor


STINNER Victor  added the comment:

Ugly workaround:

policy = asyncio.get_event_loop_policy()
policy._loop_factory = asyncio.ProactorEventLoop

It uses a private attribute :-(

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2018-06-07 Thread STINNER Victor


New submission from STINNER Victor :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com