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.
This commit is contained in:
shuwen.wu 2026-09-02 18:03:38 +08:00
parent 31ca4ddf32
commit 59ea2a5792

View file

@ -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")