Skip to content

Commit

Permalink
Copy scope.client reference as well
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py committed Dec 5, 2024
1 parent 5a09770 commit f800b34
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
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

0 comments on commit f800b34

Please sign in to comment.