[issue38955] Non indemnpotent behavior of asyncio.get_event_loop and asyncio.run sequence.

2022-03-12 Thread Andrew Svetlov
Andrew Svetlov added the comment: The usage of get_event_loop() outside of a loop is deprecated since Python 3.10 -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker

[issue38955] Non indemnpotent behavior of asyncio.get_event_loop and asyncio.run sequence.

2019-12-06 Thread Andrew Svetlov
Andrew Svetlov added the comment: Asyncio has a few own exceptions, the library tries to utilize existing ones, e.g. ValueError, TypeError, and OSError family. RuntimeError falls into this category. get_event_loop() never returns None, it was from very beginning. If we change it existing

[issue38955] Non indemnpotent behavior of asyncio.get_event_loop and asyncio.run sequence.

2019-12-05 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: Thanks Andrew; I'd still would love to have a way to get the current eventloop outside of async code that is consistent. I guess throwing an error with `get_event_loop()` is ok, it's just that `RuntimeError` feel like a weird thing to catch.

[issue38955] Non indemnpotent behavior of asyncio.get_event_loop and asyncio.run sequence.

2019-12-03 Thread Andrew Svetlov
Andrew Svetlov added the comment: I think now it is too late for changing the behavior. In the ideal world, get_event_loop() should never exist, maybe we can deprecate/remove it eventually. run() should be used for executing async code; get_running_loop() for getting a reference to the

[issue38955] Non indemnpotent behavior of asyncio.get_event_loop and asyncio.run sequence.

2019-12-02 Thread Matthias Bussonnier
New submission from Matthias Bussonnier : Hi, Not sure if this a bug, or an intended feature. I got surprise by the following behavior. from asyncio import run, sleep, get_event_loop print(get_event_loop()) # return the current eventloop run(sleep(0))