8000 fix: Forcibly stringify all JSON-unsafe values · etherscan-io/sentry-python@7dacecf · GitHub
[go: up one dir, main page]

Skip to content

Commit 7dacecf

Browse files
committed
fix: Forcibly stringify all JSON-unsafe values
1 parent 8e711dc commit 7dacecf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sentry_sdk/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from datetime import datetime
88
from collections import Mapping, Sequence
99

10-
from sentry_sdk._compat import urlparse, text_type, implements_str
10+
from sentry_sdk._compat import urlparse, text_type, implements_str, string_types, number_types
1111

1212

1313
epoch = datetime(1970, 1, 1)
@@ -533,6 +533,8 @@ def convert_types(obj):
533533
return {k: convert_types(v) for k, v in obj.items()}
534534
if isinstance(obj, Sequence) and not isinstance(obj, (text_type, bytes)):
535535
return [convert_types(v) for v in obj]
536+
if not isinstance(obj, string_types + number_types):
537+
return safe_repr(obj)
536538
return obj
537539

538540

0 commit comments

Comments
 (0)
0