Skip to content

Commit 7d21816

Browse files
authored
fix: Ensure that an envelope is cloned before it's modified (#1206)
1 parent 90ec7f7 commit 7d21816

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sentry_sdk/transport.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,10 @@ def _send_envelope(
356356
else:
357357
new_items.append(item)
358358

359-
envelope.items[:] = new_items
359+
# Since we're modifying the envelope here make a copy so that others
360+
# that hold references do not see their envelope modified.
361+
envelope = Envelope(headers=envelope.headers, items=new_items)
362+
360363
if not envelope.items:
361364
return None
362365

0 commit comments

Comments
 (0)