Browse Source

Merge ef0dcd2f11 into 8032e21418

pull/12452/merge
0xsaif 2 days ago
committed by GitHub
parent
commit
b4993df565
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 11
      fastapi/encoders.py

11
fastapi/encoders.py

@ -297,9 +297,7 @@ def jsonable_encoder(
encoded_dict[encoded_key] = encoded_value
return encoded_dict
if isinstance(obj, (list, set, frozenset, GeneratorType, tuple, deque)):
encoded_list = []
for item in obj:
encoded_list.append(
return [
jsonable_encoder(
item,
include=include,
@ -311,8 +309,8 @@ def jsonable_encoder(
custom_encoder=custom_encoder,
sqlalchemy_safe=sqlalchemy_safe,
)
)
return encoded_list
for item in obj
]
if type(obj) in ENCODERS_BY_TYPE:
return ENCODERS_BY_TYPE[type(obj)](obj)
@ -323,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:

Loading…
Cancel
Save