Closed tacaswell closed 1 year ago
This looks to resolve #1719.
Thank you, but I don't really like the global.
The problem here is that we have a situation where an event loop was set, but is not running, and calling get_running_loop()
fails. We could call get_event_loop()
which would return the event loop that was previously set, but that emits a warning on newer Python versions. So, if we call get_running_loop()
, and that fails, after which we create and set a new loop, that will leak file descriptors from the previous loop.
I'll look into using asyncio.run()
instead, and dropping Python 3.6. I think that's fine.
As near as I can tell, there is no way to ask asyncio "do you have a set but not running event loop?" as all flavors of get_event_loop
have both the auto-creation (+ warning) baked in. I do not think making new loops is so much the problem, but failing to close them (which leaves some pipes open)
I think the options (other than switching to asyncio.run()
) are all not great:
None
will still produce the warning which can happen if asyncio.run()
is called)I see #1721 was opened so I'm going to close this.
Sorry for the noise!
Partially reverts prompt-toolkit/python-prompt-toolkit#1714