mirror of https://github.com/tiangolo/fastapi.git
Remove redundant dict allocation
This commit is contained in:
parent
23d036b2d5
commit
3360cc7c69
|
|
@ -216,7 +216,7 @@ def jsonable_encoder(
|
||||||
exclude = set(exclude)
|
exclude = set(exclude)
|
||||||
if isinstance(obj, BaseModel):
|
if isinstance(obj, BaseModel):
|
||||||
# TODO: remove when deprecating Pydantic v1
|
# TODO: remove when deprecating Pydantic v1
|
||||||
encoders: Dict[Any, Any] = {}
|
encoders = None
|
||||||
if not PYDANTIC_V2:
|
if not PYDANTIC_V2:
|
||||||
encoders = getattr(obj.__config__, "json_encoders", {}) # type: ignore[attr-defined]
|
encoders = getattr(obj.__config__, "json_encoders", {}) # type: ignore[attr-defined]
|
||||||
if custom_encoder is not None:
|
if custom_encoder is not None:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue