Skip to content

Commit 7406113

Browse files
chore: Deprecate Scope.user (#4194)
The docstring for `Scope.user` says it's deprecated in favor of `Scope.set_user()`, but there is no user-facing warning. Add one so that we can [drop the property](#4193) in the next major. --------- Co-authored-by: Daniel Szoke <[email protected]>
1 parent ce0727f commit 7406113

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: sentry_sdk/scope.py

+5
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,11 @@ def set_transaction_name(self, name, source=None):
794794
def user(self, value):
795795
# type: (Optional[Dict[str, Any]]) -> None
796796
"""When set a specific user is bound to the scope. Deprecated in favor of set_user."""
797+
warnings.warn(
798+
"The `Scope.user` setter is deprecated in favor of `Scope.set_user()`.",
799+
DeprecationWarning,
800+
stacklevel=2,
801+
)
797802
self.set_user(value)
798803

799804
def set_user(self, value):

0 commit comments

Comments
 (0)