Skip to content

Commit fd8567e

Browse files
.
1 parent 8633cea commit fd8567e

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

sentry_sdk/serializer.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,7 @@ def _safe_repr_wrapper(value):
146146
def _annotate(**meta):
147147
# type: (**Any) -> None
148148
while len(meta_stack) <= len(path):
149-
try:
150-
segment = path[len(meta_stack) - 1]
151-
node = meta_stack[-1].setdefault(str(segment), {})
152-
except IndexError:
153-
node = {}
149+
node = {}
154150

155151
meta_stack.append(node)
156152

@@ -270,7 +266,6 @@ def _serialize_node_impl(
270266
if is_request_body is None:
271267
is_request_body = _is_request_body()
272268

273-
print("remaining depth", remaining_depth)
274269
if is_databag:
275270
if is_request_body and keep_request_bodies:
276271
remaining_depth = float("inf")
@@ -297,18 +292,10 @@ def _serialize_node_impl(
297292
for processor in global_repr_processors:
298293
result = processor(obj, hints)
299294
if result is not NotImplemented:
300-
print("global repr")
301295
return _flatten_annotated(result)
302296

303297
sentry_repr = getattr(type(obj), "__sentry_repr__", None)
304298

305-
print(
306-
"check for type:",
307-
type(obj),
308-
isinstance(obj, serializable_str_types),
309-
isinstance(obj, tuple(sequence_types)),
310-
)
311-
312299
if obj is None or isinstance(obj, (bool, int, float)):
313300
if should_repr_strings or (
314301
isinstance(obj, float) and (math.isinf(obj) or math.isnan(obj))
@@ -318,11 +305,9 @@ def _serialize_node_impl(
318305
return obj
319306

320307
elif callable(sentry_repr):
321-
print("callable")
322308
return sentry_repr(obj)
323309

324310
elif isinstance(obj, datetime):
325-
print("datetime")
326311
return (
327312
str(format_timestamp(obj))
328313
if not should_repr_strings
@@ -343,7 +328,6 @@ def _serialize_node_impl(
343328
break
344329

345330
str_k = str(k)
346-
print("serializing", str_k)
347331
v = _serialize_node(
348332
v,
349333
segment=str_k,
@@ -363,12 +347,10 @@ def _serialize_node_impl(
363347
elif not isinstance(obj, serializable_str_types) and isinstance(
364348
obj, tuple(sequence_types)
365349
):
366-
print("sequence type")
367350
rv_list = []
368351

369352
for i, v in enumerate(obj):
370353
if remaining_breadth is not None and i >= remaining_breadth:
371-
print("annotated", i)
372354
_annotate(len=len(obj))
373355
break
374356

@@ -389,22 +371,18 @@ def _serialize_node_impl(
389371
return rv_list
390372

391373
if should_repr_strings:
392-
print("string")
393374
obj = _safe_repr_wrapper(obj)
394375
else:
395376
if isinstance(obj, bytes) or isinstance(obj, bytearray):
396-
print("bytes")
397377
obj = obj.decode("utf-8", "replace")
398378

399379
if not isinstance(obj, str):
400-
print("not string")
401380
obj = _safe_repr_wrapper(obj)
402381

403382
is_span_description = (
404383
len(path) == 3 and path[0] == "spans" and path[-1] == "description"
405384
)
406385
if is_span_description:
407-
print("is_description")
408386
return obj
409387

410388
return _flatten_annotated(strip_string(obj, max_length=max_value_length))
@@ -416,7 +394,6 @@ def _serialize_node_impl(
416394
try:
417395
serialized_event = _serialize_node(event, **kwargs)
418396
if not is_vars and meta_stack and isinstance(serialized_event, dict):
419-
print("serialized event", serialized_event)
420397
serialized_event["_meta"] = meta_stack[0]
421398

422399
return serialized_event

0 commit comments

Comments
 (0)