From a95e91e46e230db27a75f39639a1f255a8b177ae Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 20 Sep 2025 21:05:51 +0900 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20mypy=20to=201.14.?= =?UTF-8?q?1=20(#12970)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com> Co-authored-by: Sofie Van Landeghem Co-authored-by: svlandeg Co-authored-by: svlandeg --- fastapi/encoders.py | 1 + fastapi/routing.py | 1 + requirements-tests.txt | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fastapi/encoders.py b/fastapi/encoders.py index 451ea0760..0ad548b94 100644 --- a/fastapi/encoders.py +++ b/fastapi/encoders.py @@ -241,6 +241,7 @@ def jsonable_encoder( sqlalchemy_safe=sqlalchemy_safe, ) if dataclasses.is_dataclass(obj): + assert not isinstance(obj, type) obj_dict = dataclasses.asdict(obj) return jsonable_encoder( obj_dict, diff --git a/fastapi/routing.py b/fastapi/routing.py index 54c75a027..5418ad982 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -120,6 +120,7 @@ def _prepare_response_content( for k, v in res.items() } elif dataclasses.is_dataclass(res): + assert not isinstance(res, type) return dataclasses.asdict(res) return res diff --git a/requirements-tests.txt b/requirements-tests.txt index 7c1fd12f7..e87a42162 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -2,7 +2,7 @@ -r requirements-docs-tests.txt pytest >=7.1.3,<9.0.0 coverage[toml] >= 6.5.0,< 8.0 -mypy ==1.8.0 +mypy ==1.14.1 dirty-equals ==0.9.0 sqlmodel==0.0.24 flask >=1.1.2,<4.0.0