From 59ea2a579247f60f3bcce17d416852c608d4d866 Mon Sep 17 00:00:00 2001 From: "shuwen.wu" Date: Wed, 2 Sep 2026 18:03:38 +0800 Subject: [PATCH] Fix mutable default argument in InfinityError.__init__ Use None as default and initialize empty dict inside the function to prevent mutable default argument anti-pattern. --- litellm/llms/infinity/common_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/llms/infinity/common_utils.py b/litellm/llms/infinity/common_utils.py index e23fe4a0d37..c3503c1f6c0 100644 --- a/litellm/llms/infinity/common_utils.py +++ b/litellm/llms/infinity/common_utils.py @@ -4,7 +4,9 @@ from litellm.llms.base_llm.chat.transformation import BaseLLMException class InfinityError(BaseLLMException): - def __init__(self, status_code: int, message: str, headers: dict | httpx.Headers = {}): + def __init__(self, status_code: int, message: str, headers: dict | httpx.Headers | None = None): + if headers is None: + headers = {} self.status_code = status_code self.message = message self.request = httpx.Request(method="POST", url="https://github.com/michaelfeil/infinity")