From a227c4e206b694b6024992c333a5cbfcf71043e7 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Wed, 17 Dec 2025 15:59:10 +0100 Subject: [PATCH] fix(ray): Guard against module shadowing --- sentry_sdk/integrations/ray.py | 3 ++- tests/test_shadowed_module.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sentry_sdk/integrations/ray.py b/sentry_sdk/integrations/ray.py index 92a35546ab..e6cceb1e8c 100644 --- a/sentry_sdk/integrations/ray.py +++ b/sentry_sdk/integrations/ray.py @@ -16,6 +16,7 @@ try: import ray # type: ignore[import-not-found] + from ray import remote except ImportError: raise DidNotEnable("Ray not installed.") @@ -37,7 +38,7 @@ def _check_sentry_initialized() -> None: def _patch_ray_remote() -> None: - old_remote = ray.remote + old_remote = remote @functools.wraps(old_remote) def new_remote( diff --git a/tests/test_shadowed_module.py b/tests/test_shadowed_module.py index e1171dd103..82321cebb9 100644 --- a/tests/test_shadowed_module.py +++ b/tests/test_shadowed_module.py @@ -34,7 +34,6 @@ def pytest_generate_tests(metafunc): "litellm", "opentelemetry", "pure_eval", - "ray", "trytond", "typer", },