Skip to content

Fix scope client reference on copy/fork #3849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def __copy__(self):
rv = object.__new__(self.__class__) # type: Scope

rv._type = self._type
rv.client = self.client
rv._level = self._level
rv._name = self._name
rv._fingerprint = self._fingerprint
Expand Down
5 changes: 3 additions & 2 deletions tests/test_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use_scope,
use_isolation_scope,
)
from tests.conftest import ApproxDict


SLOTS_NOT_COPIED = {"client"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove code related to SLOTS_NOT_COPIED

Expand Down Expand Up @@ -806,8 +807,8 @@ def test_nested_scopes_with_tags(sentry_init, capture_envelopes):
transaction = envelope.items[0].get_transaction_event()

assert transaction["tags"] == {"isolation_scope1": 1, "current_scope2": 1, "trx": 1}
assert transaction["spans"][0]["tags"] == {"a": 1}
assert transaction["spans"][1]["tags"] == {"b": 1}
assert transaction["spans"][0]["tags"] == ApproxDict({"a": 1})
assert transaction["spans"][1]["tags"] == ApproxDict({"b": 1})


def test_should_send_default_pii_true(sentry_init):
Expand Down
Loading