From 51350e176928c3a135baff188b6146e5f0038ddf Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 16 Sep 2026 09:45:39 +0200 Subject: [PATCH] [json] Require a `LiteralString` for `indent` argument --- stdlib/json/__init__.pyi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stdlib/json/__init__.pyi b/stdlib/json/__init__.pyi index 2342b29cb0c8..3542ced5ea33 100644 --- a/stdlib/json/__init__.pyi +++ b/stdlib/json/__init__.pyi @@ -2,6 +2,7 @@ import sys from _typeshed import SupportsRead, SupportsWrite from collections.abc import Callable from typing import Any, Literal +from typing_extensions import LiteralString from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDecoder from .encoder import JSONEncoder as JSONEncoder @@ -16,7 +17,7 @@ def dumps( check_circular: bool = True, allow_nan: bool = True, cls: type[JSONEncoder] | None = None, - indent: None | int | str = None, + indent: None | int | LiteralString = None, separators: tuple[str, str] | None = None, default: Callable[[Any], Any] | None = None, sort_keys: bool = False, @@ -31,7 +32,7 @@ def dump( check_circular: bool = True, allow_nan: bool = True, cls: type[JSONEncoder] | None = None, - indent: None | int | str = None, + indent: None | int | LiteralString = None, separators: tuple[str, str] | None = None, default: Callable[[Any], Any] | None = None, sort_keys: bool = False,