From a84d0fc80e710c2d2391fc9b734c57cde32a8089 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Thu, 5 Feb 2026 13:22:25 +0100 Subject: [PATCH] ref: Remove references to unsupported attribute types --- sentry_sdk/utils.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index 79ef5a2cef..29827db44e 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -2062,23 +2062,15 @@ def format_attribute(val: "Any") -> "AttributeValue": if isinstance(val, (bool, int, float, str)): return val - # Only lists of elements of a single type are supported - list_types: 'dict[type, Literal["string[]", "integer[]", "double[]", "boolean[]"]]' = { - str: "string[]", - int: "integer[]", - float: "double[]", - bool: "boolean[]", - } - if isinstance(val, (list, tuple)) and not val: return [] elif isinstance(val, list): ty = type(val[0]) - if ty in list_types and all(type(v) is ty for v in val): + if ty in (str, int, float, bool) and all(type(v) is ty for v in val): return copy.deepcopy(val) elif isinstance(val, tuple): ty = type(val[0]) - if ty in list_types and all(type(v) is ty for v in val): + if ty in (str, int, float, bool) and all(type(v) is ty for v in val): return list(val) return safe_repr(val)