Commit 2b85ccd
Python: Fix windows runtime error: adapt asyncio event loop policy for windows python 3.10 and above (#1416)
### Motivation and Context
To fix a runtime error on windows for python version 3.10, 3.11 and
above
On windows, python version above 3.10.1, there will be a runtime error
caused by asyncio event loop. add adapting code for windows when python
version is above 3.10.1 to avoid the error.
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Refer link:
https://docs.python.org/3/library/asyncio-policy.html
"Note In Python versions 3.10.9, 3.11.1 and 3.12 the
[get_event_loop()](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop)
method of the default asyncio policy emits a
[DeprecationWarning](https://docs.python.org/3/library/exceptions.html#DeprecationWarning)
if there is no running event loop and no current loop is set. In some
future Python release this will become an error."
Note: per testing, this error also occurred on python 3.10 below 3.10.9
Co-authored-by: Mark Karle <mkarle@users.noreply.github.com>
Co-authored-by: Lee Miller <lemiller@microsoft.com>1 parent e30229a commit 2b85ccd
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
0 commit comments