diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 34ccc7f940..bb45143c48 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -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 diff --git a/tests/test_scope.py b/tests/test_scope.py index 374a354446..a03eb07a99 100644 --- a/tests/test_scope.py +++ b/tests/test_scope.py @@ -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 = {} @@ -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)