Skip to content

Commit 396d534

Browse files
committed
Fix scope client reference on copy/fork
1 parent c4f2a2a commit 396d534

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sentry_sdk/scope.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ def __copy__(self):
202202
rv = object.__new__(self.__class__) # type: Scope
203203

204204
rv._type = self._type
205+
rv.client = self.client
205206
rv._level = self._level
206207
rv._name = self._name
207208
rv._fingerprint = self._fingerprint

tests/test_scope.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use_scope,
2424
use_isolation_scope,
2525
)
26+
from tests.conftest import ApproxDict
2627

2728

2829
SLOTS_NOT_COPIED = {"client"}
@@ -806,8 +807,8 @@ def test_nested_scopes_with_tags(sentry_init, capture_envelopes):
806807
transaction = envelope.items[0].get_transaction_event()
807808

808809
assert transaction["tags"] == {"isolation_scope1": 1, "current_scope2": 1, "trx": 1}
809-
assert transaction["spans"][0]["tags"] == {"a": 1}
810-
assert transaction["spans"][1]["tags"] == {"b": 1}
810+
assert transaction["spans"][0]["tags"] == ApproxDict({"a": 1})
811+
assert transaction["spans"][1]["tags"] == ApproxDict({"b": 1})
811812

812813

813814
def test_should_send_default_pii_true(sentry_init):

0 commit comments

Comments
 (0)