Skip to content

Commit 36f94c2

Browse files
committed
make mypy happy
1 parent ef0c412 commit 36f94c2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sentry_sdk/integrations/asyncio.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
except ImportError:
1313
raise DidNotEnable("asyncio not available")
1414

15-
from typing import TYPE_CHECKING
15+
from typing import TYPE_CHECKING, cast
1616

1717
if 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

0 commit comments

Comments
 (0)