Skip to content
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

Copy scope.client reference as well #3857

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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 @@ -225,6 +225,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
6 changes: 1 addition & 5 deletions tests/test_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
)


SLOTS_NOT_COPIED = {"client"}
"""__slots__ that are not copied when copying a Scope object."""


def test_copying():
s1 = Scope()
s1.fingerprint = {}
Expand All @@ -43,7 +39,7 @@ def test_all_slots_copied():
scope_copy = copy.copy(scope)

# Check all attributes are copied
for attr in set(Scope.__slots__) - SLOTS_NOT_COPIED:
for attr in set(Scope.__slots__):
assert getattr(scope_copy, attr) == getattr(scope, attr)


Expand Down
Loading