Skip to content

Commit ce5f8ac

Browse files
committed
run_coroutine no longer takes a scope argument
Closes #15.
1 parent 2761766 commit ce5f8ac

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

trio_asyncio/loop.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,35 @@ def wrap_generator(proc, *args):
178178

179179

180180
async def run_asyncio(proc, *args):
181+
"""Run an asyncio function or method from Trio.
182+
183+
:return: whatever the procedure returns.
184+
:raises: whatever the procedure raises.
185+
186+
This is a Trio coroutine.
187+
"""
188+
181189
loop = asyncio.get_event_loop()
182190
if not isinstance(loop, TrioEventLoop):
183191
raise RuntimeError("Need to run in a trio_asyncio.open_loop() context")
184192
return await loop.run_asyncio(proc, *args)
185193

186194

187-
async def run_coroutine(fut, scope=None):
195+
async def run_coroutine(fut):
196+
"""Wait for an asyncio future/coroutine.
197+
198+
Cancelling the current Trio scope will cancel the future/coroutine.
199+
200+
Cancelling the future/coroutine will cause an
201+
``asyncio.CancelledError``.
202+
203+
This is a Trio coroutine.
204+
"""
205+
188206
loop = asyncio.get_event_loop()
189207
if not isinstance(loop, TrioEventLoop):
190208
raise RuntimeError("Need to run in a trio_asyncio.open_loop() context")
191-
return await loop.run_coroutine(fut, scope=scope)
209+
return await loop.run_coroutine(fut)
192210

193211

194212
def run_trio(proc, *args):

0 commit comments

Comments
 (0)