From ef0dcd2f11ac354be03551f2d2670a57f908ff24 Mon Sep 17 00:00:00 2001 From: saif Date: Mon, 14 Oct 2024 13:14:50 +0300 Subject: [PATCH] refactor: Initialize 'errors' list and append 'e' to it in one line --- fastapi/encoders.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fastapi/encoders.py b/fastapi/encoders.py index bb96b162a..cc0d26a28 100644 --- a/fastapi/encoders.py +++ b/fastapi/encoders.py @@ -321,8 +321,7 @@ def jsonable_encoder( try: data = dict(obj) except Exception as e: - errors: List[Exception] = [] - errors.append(e) + errors: List[Exception] = [e] try: data = vars(obj) except Exception as e: