From 91de7190709a20a2b9c2835a3a69287bc55481c5 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Wed, 17 Dec 2025 15:47:30 +0100 Subject: [PATCH] fix(typer): Guard against module shadowing --- sentry_sdk/integrations/typer.py | 3 ++- tests/test_shadowed_module.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sentry_sdk/integrations/typer.py b/sentry_sdk/integrations/typer.py index be3d7d1d68..2865f3ee6f 100644 --- a/sentry_sdk/integrations/typer.py +++ b/sentry_sdk/integrations/typer.py @@ -22,6 +22,7 @@ try: import typer + from typer.main import except_hook except ImportError: raise DidNotEnable("Typer not installed") @@ -31,7 +32,7 @@ class TyperIntegration(Integration): @staticmethod def setup_once() -> None: - typer.main.except_hook = _make_excepthook(typer.main.except_hook) # type: ignore + typer.main.except_hook = _make_excepthook(except_hook) # type: ignore def _make_excepthook(old_excepthook: "Excepthook") -> "Excepthook": diff --git a/tests/test_shadowed_module.py b/tests/test_shadowed_module.py index e1171dd103..333167df0e 100644 --- a/tests/test_shadowed_module.py +++ b/tests/test_shadowed_module.py @@ -36,7 +36,6 @@ def pytest_generate_tests(metafunc): "pure_eval", "ray", "trytond", - "typer", }, )