Skip to content

Commit c394a71

Browse files
committed
Add newsfragment, document AsyncHandle callback color
1 parent 5a1f7d6 commit c394a71

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

newsfragments/76.bugfix.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
On Python versions with native contextvars support (3.7+), a Trio task
2+
started from asyncio context (using :func:`trio_as_aio`,
3+
:meth:`~BaseTrioEventLoop.trio_as_future`, etc) will now properly
4+
inherit the contextvars of its caller. Also, if the entire
5+
trio-asyncio loop is cancelled, such tasks will no longer let
6+
`trio.Cancelled` exceptions leak into their asyncio caller.

trio_asyncio/_handles.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ def _raise(self, exc):
5555

5656

5757
class AsyncHandle(ScopedHandle):
58-
"""A ScopedHandle associated with the execution of an async function.
58+
"""A ScopedHandle associated with the execution of a Trio-flavored
59+
async function.
60+
5961
If the handle is cancelled, the cancel scope surrounding the async function
6062
will be cancelled too. It is also possible to link a future to the result
6163
of the async function. If you do that, the future will evaluate to the
6264
result of the function, and cancelling the future will cancel the handle too.
65+
6366
"""
6467

6568
__slots__ = ("_fut", "_started")

0 commit comments

Comments
 (0)