Skip to content

Commit

Permalink
stop setting asyncio in the contextvar
Browse files Browse the repository at this point in the history
Refs #20
  • Loading branch information
graingert authored Mar 4, 2021
1 parent e8de439 commit 2766dc0
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions sniffio/_impl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from contextvars import ContextVar
from typing import Optional
import sys

current_async_library_cvar = ContextVar(
"current_async_library_cvar", default=None
Expand Down Expand Up @@ -65,10 +64,6 @@ async def generic_sleep(seconds):
current_task = asyncio.Task.current_task # type: ignore[attr-defined]
try:
if current_task() is not None:
if (3, 7) <= sys.version_info:
# asyncio has contextvars support, and we're in a task, so
# we can safely cache the sniffed value
current_async_library_cvar.set("asyncio")
return "asyncio"
except RuntimeError:
pass
Expand Down

0 comments on commit 2766dc0

Please sign in to comment.