From 47aafc9d7e89f7b87f37f8856d5e2ade6a51c5b2 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Mon, 12 Jan 2026 17:37:59 +0100 Subject: [PATCH 1/2] fix: Handle channels shadowing --- sentry_sdk/integrations/threading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/threading.py b/sentry_sdk/integrations/threading.py index 6311b935a0..1624bf1dcf 100644 --- a/sentry_sdk/integrations/threading.py +++ b/sentry_sdk/integrations/threading.py @@ -57,7 +57,7 @@ def setup_once() -> None: import channels # type: ignore[import-untyped] channels_version = channels.__version__ - except ImportError: + except (ImportError, AttributeError): django_version = None channels_version = None From d34f79657614b0162e0ec5a517c6a2586ddf6625 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 13 Jan 2026 10:53:41 +0100 Subject: [PATCH 2/2] make more future proof --- sentry_sdk/integrations/threading.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/threading.py b/sentry_sdk/integrations/threading.py index 1624bf1dcf..5b5633507f 100644 --- a/sentry_sdk/integrations/threading.py +++ b/sentry_sdk/integrations/threading.py @@ -54,11 +54,14 @@ def setup_once() -> None: try: from django import VERSION as django_version # noqa: N811 + except ImportError: + django_version = None + + try: import channels # type: ignore[import-untyped] channels_version = channels.__version__ except (ImportError, AttributeError): - django_version = None channels_version = None is_async_emulated_with_threads = (