From: Tamir Duberstein Date: Sat, 20 Sep 2025 12:05:51 +0000 (+0900) Subject: ⬆️ Update mypy to 1.14.1 (#12970) X-Git-Tag: 0.117.0~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a95e91e46e230db27a75f39639a1f255a8b177ae;p=thirdparty%2Ffastapi%2Ffastapi.git ⬆️ Update mypy to 1.14.1 (#12970) 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 --- 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