From e082861b5501ae46d0c009cacff2139e4c0be2ba Mon Sep 17 00:00:00 2001 From: 1divyanshdev Date: Thu, 29 Oct 2026 23:31:53 +0530 Subject: [PATCH] fix(wrapper): pin known partially-unknown member accesses in failure cleanup --- litellm/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index f4d5714c315..154f244d059 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -2170,8 +2170,8 @@ def client(original_function): # traceback frames cannot pin this request's Logging object (and through # it the request payload) in a reference cycle only a GC pass can help. if logging_obj is not None: - logging_obj.model_call_details.pop("exception", None) - kwargs.pop("litellm_logging_obj", None) + logging_obj.model_call_details.pop("exception", None) # pyright: ignore[reportUnknownMemberType] # model_call_details is a partially-unknown union upstream of the Logging base + kwargs.pop("litellm_logging_obj", None) # pyright: ignore[reportUnknownMemberType] # kwargs is the untyped request **kwargs dict del logging_obj raise e @@ -2324,7 +2324,7 @@ def client(original_function): # The uncached-input dict is a wrapper-private copy of kwargs whose # request never left this frame except as part of the failure # traceback below, so its logging reference is released here. - call_kwargs.pop("litellm_logging_obj", None) + call_kwargs.pop("litellm_logging_obj", None) # pyright: ignore[reportUnknownMemberType] # kwargs is the untyped request **kwargs dict raise end_time = datetime.datetime.now() @@ -2505,8 +2505,8 @@ def client(original_function): # here because the finally block below still needs it to restore # correlation contextvars. if logging_obj is not None and not _is_litellm_internal_call: - logging_obj.model_call_details.pop("exception", None) - kwargs.pop("litellm_logging_obj", None) + logging_obj.model_call_details.pop("exception", None) # pyright: ignore[reportUnknownMemberType] # model_call_details is a partially-unknown union upstream of the Logging base + kwargs.pop("litellm_logging_obj", None) # pyright: ignore[reportUnknownMemberType] # kwargs is the untyped request **kwargs dict raise e finally: