File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ async def _test_same_task():
5252 def get_loop (i ):
5353 loops [i ] = (asyncio .get_event_loop (), asyncio .get_event_loop_policy ())
5454
55- async with trio .open_nursery () as n :
55+ async with trio .open_nursery ():
5656 async with trio_asyncio .open_loop () as loop1 :
5757 async with trio_asyncio .open_loop () as loop2 :
5858 loop1 .call_later (0.1 , get_loop , 0 )
Original file line number Diff line number Diff line change 11import trio
2- import asyncio
32
43from async_generator import async_generator , yield_ , asynccontextmanager
54
Original file line number Diff line number Diff line change 11import os
22import sys
3- import inspect
43import math
54import trio
65import heapq
Original file line number Diff line number Diff line change 3636class _TrioPolicy (asyncio .events .BaseDefaultEventLoopPolicy ):
3737 _loop_factory = TrioEventLoop
3838
39- def __init__ (self ):
40- super ().__init__ ()
41- current_loop = trio .TaskLocal (_loop = None , _task = False )
42-
4339 def new_event_loop (self ):
4440 try :
4541 trio .hazmat .current_task ()
@@ -102,6 +98,8 @@ def set_event_loop(self, loop):
10298
10399from asyncio import events as _aio_event
104100
101+ #####
102+
105103_orig_policy_get = _aio_event .get_event_loop_policy
106104
107105
@@ -120,10 +118,12 @@ def _new_policy_get():
120118_aio_event .get_event_loop_policy = _new_policy_get
121119asyncio .get_event_loop_policy = _new_policy_get
122120
121+ #####
122+
123123_orig_run_get = _aio_event ._get_running_loop
124124
125125
126- def _new_loop_get ():
126+ def _new_run_get ():
127127 try :
128128 return _current_loop .loop
129129 except RuntimeError :
@@ -132,6 +132,8 @@ def _new_loop_get():
132132
133133_aio_event ._get_running_loop = _new_run_get
134134
135+ #####
136+
135137_orig_loop_get = _aio_event .get_event_loop
136138
137139
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ async def consume_next():
6363 item = STOP
6464
6565 trio .hazmat .reschedule (task , trio .hazmat .Value (value = item ))
66- #trio.hazmat.reschedule(task, STOP)
66+ # trio.hazmat.reschedule(task, STOP)
6767
6868 def abort_cb (raise_cancel_arg ):
6969 # Save the cancel-raising function
You can’t perform that action at this time.
0 commit comments