[issue38423] Event loop implementation docs advertise set_event_loop which doesn't work with asyncio.run

2020-01-27 Thread Cilyan Olowen


Cilyan Olowen  added the comment:

My bad, I did not check that asyncio.Event() was called before the application 
has a chance to properly set_event_loop with custom one.

--

___
Python tracker 

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



[issue38423] Event loop implementation docs advertise set_event_loop which doesn't work with asyncio.run

2020-01-27 Thread Cilyan Olowen


Cilyan Olowen  added the comment:

It doesn't seem to work either for asyncio.get_event_loop, especially when 
using asyncio.wait(), the loop complains that 

"RuntimeError: Task  cb=[_wait.._on_completion() at 
lib\asyncio\tasks.py:440]> got Future  attached to a different 
loop"

--
nosy: +Cilyan Olowen

___
Python tracker 

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



[issue38423] Event loop implementation docs advertise set_event_loop which doesn't work with asyncio.run

2019-10-09 Thread Yury Selivanov


Yury Selivanov  added the comment:

Yes, docs updates sound good.

--

___
Python tracker 

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



[issue38423] Event loop implementation docs advertise set_event_loop which doesn't work with asyncio.run

2019-10-09 Thread Hrvoje Nikšić

Change by Hrvoje Nikšić :


--
title: Event loop implementation docs advertise set_event_loop -> Event loop 
implementation docs advertise set_event_loop which doesn't work with asyncio.run

___
Python tracker 

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



[issue38423] Event loop implementation docs advertise set_event_loop

2019-10-09 Thread Hrvoje Nikšić

New submission from Hrvoje Nikšić :

The docs of SelectorEventLoop and ProactorEventLoop contain examples that call 
asyncio.set_event_loop:

  selector = selectors.SelectSelector()
  loop = asyncio.SelectorEventLoop(selector)
  asyncio.set_event_loop(loop)

But this won't have any effect on code that uses asyncio.run(), because 
asyncio.run() creates a fresh event loop. Since asyncio.run() is the 
recommended way to execute async code and is used consistently throughout the 
documentation, this might be confusing to someone who tries to e.g. use the 
proactor loop on Windows.

I propose the following:

* add a disclaimer that instantiating the event loop won't affect calls to 
asyncio.run(), and that loop.run_until_complete() must be used; and

* link to asyncio.set_event_loop_policy(), which does work with asyncio.run(), 
but doesn't allow fine-tuning the details, such as which selector to use for 
the SelectorEventLoop.

--
assignee: docs@python
components: Documentation, asyncio
messages: 354288
nosy: asvetlov, docs@python, hniksic, yselivanov
priority: normal
severity: normal
status: open
title: Event loop implementation docs advertise set_event_loop
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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