From d468fdbcd1042cdad94baf781c3d550a3e99b917 Mon Sep 17 00:00:00 2001 From: Crypto Nite Date: Fri, 15 May 2026 19:01:53 -0700 Subject: [PATCH] Fix JsonType to use `Any` for Mapping values The recursive JsonType definition used Mapping[str, "JsonType"], which caused mypy to reject valid dict subtypes like dict[str, object] or dict[str, Collection[str]] due to mypy's invariance handling of recursive Mapping types. The fix replaces the recursive Mapping value type with Any, matching how Python's json.dumps actually accepts any serializable value. Fixes #7443 --- src/requests/_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/requests/_types.py b/src/requests/_types.py index b2273d612b..e3369f734f 100644 --- a/src/requests/_types.py +++ b/src/requests/_types.py @@ -144,7 +144,7 @@ class _ValidatedRequest(PreparedRequest): | float | str | Sequence["JsonType"] - | Mapping[str, "JsonType"] + | Mapping[str, Any] ) # TypedDicts for Unpack kwargs (PEP 692)