Message357727
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))
print(get_event_loop()) # raise a RuntimeError
I would expect `get_event_loop` to get back to it's initial default value.
This comes from the fact that `run()` call `set_event_loop()` to `None`. with
both sets `_set_called` to `True`, but `get_event_loop` seem to assume if
_set_called is True, then loop cannot be none.
I'm tempted to think that if `set_loop()` is called with `None`, it should reset the `_set_called` to False. Or Am I supposed to call `set_event_loop(new_event_loop())` myself ?
I'm likely missing something so any insight would be appreciated; if you
believe this is an actual issue I'm happy to send a PR. |
|
Date |
User |
Action |
Args |
2019-12-02 18:39:47 | mbussonn | set | recipients:
+ mbussonn, asvetlov, yselivanov |
2019-12-02 18:39:47 | mbussonn | set | messageid: <1575311987.47.0.389219942485.issue38955@roundup.psfhosted.org> |
2019-12-02 18:39:47 | mbussonn | link | issue38955 messages |
2019-12-02 18:39:47 | mbussonn | create | |
|