Skip to content

Commit

Permalink
♻ Move internal variable for errors in jsonable_encoder to put rela…
Browse files Browse the repository at this point in the history
…ted code closer (#4560)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
  • Loading branch information
GuilleQP and tiangolo committed Aug 26, 2022
1 parent c812449 commit a64387c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fastapi/encoders.py
Expand Up @@ -137,10 +137,10 @@ def jsonable_encoder(
if isinstance(obj, classes_tuple):
return encoder(obj)

errors: List[Exception] = []
try:
data = dict(obj)
except Exception as e:
errors: List[Exception] = []
errors.append(e)
try:
data = vars(obj)
Expand Down

0 comments on commit a64387c

Please sign in to comment.