Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use get_running_loop() instead of get_event_loop()
This PR proposes to change get_event_loop() to get_running_loop() in `prompt_toolkit/application.py` to improve compatibility on Windows. As mentioned in other places of the prompt_toolkit codebase, get_running_loop() is the recommended way to get the event loop since Python 3.7, because it returns the running loop for the current context instead of strictly the default loop. This is important for prompt_toolkit to work properly on Windows, where the default loop may not be compatible. Using get_running_loop() can avoid potential issues with an incompatible default loop. The usage of get_event_loop() in `prompt_toolkit/application.py` seems to be leftover from early development, and was likely forgotten to be changed when adding Windows support. All other occurrences have been updated to `use get_running_loop()`. Replacing this instance of get_event_loop() with get_running_loop() should improve portability without introducing side effects. It follows the prompting_toolkit's design goal of being cross-platform compatible. Therefore, I propose we make this change to remain consistent with the rest of the codebase and avoid potential bugs on Windows. Please consider merging this PR to use get_running_loop() instead of get_event_loop() in application.py. Let me know if any changes are necessary. Thanks!
- Loading branch information