From d4e81acbe1ade3a70310ca8302ecf75c0241cef4 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Thu, 26 Nov 2026 10:47:40 -0500 Subject: [PATCH] refactor(web): remove unreachable resp checks from the async request loop `resp` in `_request_with_session` is declared `None` and never assigned, so `if resp is not None: return resp` never runs. The trailing `return response` after the try/finally is unreachable too: the try body always returns or raises. `raise last_error` is kept as is. Co-Authored-By: Claude --- slack_sdk/web/async_internal_utils.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/slack_sdk/web/async_internal_utils.py b/slack_sdk/web/async_internal_utils.py index 5ead1dc85..373b22777 100644 --- a/slack_sdk/web/async_internal_utils.py +++ b/slack_sdk/web/async_internal_utils.py @@ -69,7 +69,6 @@ async def _request_with_session( ) last_error: Optional[Exception] = None - resp: Optional[Dict[str, Any]] = None try: retry_request = RetryHttpRequest( method=http_verb, @@ -217,12 +216,8 @@ def convert_params(values: dict) -> dict: if retry_state.next_attempt_requested is False: raise last_error - if resp is not None: - return resp raise last_error # type: ignore[misc] finally: if not use_running_session: await session.close() # type: ignore[union-attr] - - return response