diff --git a/newsfragments/2700.misc.rst b/newsfragments/2700.misc.rst new file mode 100644 index 0000000000..a70924816e --- /dev/null +++ b/newsfragments/2700.misc.rst @@ -0,0 +1,4 @@ +Trio now indicates its presence to `sniffio` using the ``sniffio.thread_local`` +interface that is preferred since sniffio v1.3.0. This should be less likely +than the previous approach to cause :func:`sniffio.current_async_library` to +return incorrect results due to unintended inheritance of contextvars. diff --git a/trio/_util.py b/trio/_util.py index 01a5bfccdb..62ff6d8681 100644 --- a/trio/_util.py +++ b/trio/_util.py @@ -10,9 +10,10 @@ from abc import ABCMeta from functools import update_wrapper -import trio from sniffio import thread_local as sniffio_loop +import trio + # Equivalent to the C function raise(), which Python doesn't wrap if os.name == "nt": # On Windows, os.kill exists but is really weird.