From a72eec9d191ae60b4dff7a9e76b234cf523f2b59 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Tue, 20 Feb 2024 08:03:47 +0100 Subject: [PATCH] Removed unused scope parameter --- sentry_sdk/scope.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 722f671a12..e951e967a5 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -1434,13 +1434,12 @@ def __repr__(self): @contextmanager -def new_scope(scope=None): - # type: (Optional[Scope]) -> Generator[Scope, None, None] +def new_scope(): + # type: () -> Generator[Scope, None, None] """ .. versionadded:: 2.0.0 - Context manager that either uses the given `scope` or - forks the current scope and runs the wrapped code in it. + Context manager that forks the current scope and runs the wrapped code in it. After the wrapped code is executed, the original scope is restored. Example Usage: @@ -1456,14 +1455,9 @@ def new_scope(scope=None): sentry_sdk.capture_message("hello, again") # will NOT include `color` tag. """ - if scope is not None: - # use given scope - new_scope = scope - else: - # fork current scope - current_scope = Scope.get_current_scope() - new_scope = current_scope.fork() - + # fork current scope + current_scope = Scope.get_current_scope() + new_scope = current_scope.fork() token = _current_scope.set(new_scope) try: