File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 6
6
import asyncio
7
7
import inspect
8
8
import os
9
+ import sys
9
10
10
11
11
12
def run_sync (coro ):
12
13
def wrapped (* args , ** kwargs ):
13
14
try :
14
15
loop = asyncio .get_running_loop ()
15
16
except RuntimeError :
16
- # Workaround for bugs.python.org/issue39529.
17
- try :
18
- loop = asyncio .get_event_loop_policy ().get_event_loop ()
19
- except RuntimeError :
17
+ # In python 3.10.9 this workaround breaks some tests
18
+ # test_client.TestKernelClient
19
+ # https://docs.python.org/3.10/whatsnew/changelog.html#id3
20
+ if sys .version_info <= (3 , 10 , 8 ):
21
+ # Workaround for bugs.python.org/issue39529.
22
+ try :
23
+ loop = asyncio .get_event_loop_policy ().get_event_loop ()
24
+ except RuntimeError :
25
+ loop = asyncio .new_event_loop ()
26
+ asyncio .set_event_loop (loop )
27
+ else :
20
28
loop = asyncio .new_event_loop ()
21
29
asyncio .set_event_loop (loop )
22
30
import nest_asyncio # type: ignore
You can’t perform that action at this time.
0 commit comments