File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1212except ImportError :
1313 raise DidNotEnable ("asyncio not available" )
1414
15- from typing import TYPE_CHECKING
15+ from typing import TYPE_CHECKING , cast
1616
1717if TYPE_CHECKING :
1818 from typing import Any
@@ -39,6 +39,7 @@ def patch_asyncio():
3939
4040 # Add a shutdown handler to log a helpful message
4141 def shutdown_handler ():
42+ # type: () -> None
4243 logger .info (
4344 "AsyncIO is shutting down. If you see 'Task was destroyed but it is pending!' "
4445 "errors with '_task_with_sentry_span_creation', these are normal during shutdown "
@@ -94,7 +95,9 @@ async def _task_with_sentry_span_creation():
9495
9596 # Set the task name to include the original coroutine's name
9697 try :
97- task .set_name (f"{ get_name (coro )} (Sentry-wrapped)" )
98+ cast (asyncio .Task [Any ], task ).set_name (
99+ f"{ get_name (coro )} (Sentry-wrapped)"
100+ )
98101 except AttributeError :
99102 # set_name might not be available in all Python versions
100103 pass
You can’t perform that action at this time.
0 commit comments