From 17a33370022626b11ce7fc48ed7633503f696aa9 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Wed, 18 Mar 2026 07:46:07 +0800 Subject: [PATCH 1/7] Fix #146061 --- Doc/library/json.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 4a26419e65bee4..6578544976f2f4 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -211,7 +211,9 @@ Basic Usage a string (such as ``"\t"``) is used to indent each level. If zero, negative, or ``""`` (the empty string), only newlines are inserted. - If ``None`` (the default), the most compact representation is used. + If ``None`` (the default), no pretty printing is done, and a + compact representation is used, though a singular space is + still left after the separators. :type indent: int | str | None :param separators: From a5c0e64bc0eb3c472c6b400f0374eaa77bd155a9 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Wed, 18 Mar 2026 20:12:43 +0800 Subject: [PATCH 2/7] Remove trailing space Co-authored-by: Pieter Eendebak --- Doc/library/json.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 6578544976f2f4..e01faa63f07f93 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -212,7 +212,7 @@ Basic Usage If zero, negative, or ``""`` (the empty string), only newlines are inserted. If ``None`` (the default), no pretty printing is done, and a - compact representation is used, though a singular space is + compact representation is used, though a singular space is still left after the separators. :type indent: int | str | None From 539d82c574aa9dc2480bbe0eb1f9c13961287167 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 09:16:01 +0800 Subject: [PATCH 3/7] Edit json.dump docstring --- Lib/json/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py index 89396b25a2cbb3..96f606523c903b 100644 --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -142,9 +142,9 @@ def dump(obj, fp, *, skipkeys=False, ensure_ascii=True, check_circular=True, If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent - level of 0 will only insert newlines. ``None`` is the most compact - representation. - + level of 0 will only insert newlines. ``None`` gives a compact + representation; see below. + If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON From 62a65d90e341cbbe386f56883d9dd300153ceedd Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 09:18:53 +0800 Subject: [PATCH 4/7] Remove trailing whitespace --- Lib/json/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py index 96f606523c903b..2953c5cbc13369 100644 --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -144,7 +144,7 @@ def dump(obj, fp, *, skipkeys=False, ensure_ascii=True, check_circular=True, object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` gives a compact representation; see below. - + If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON From 307fbf19b58fb846ea0a4b99711ed38027571549 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 16:37:40 +0800 Subject: [PATCH 5/7] Shorten description Co-authored-by: Serhiy Storchaka --- Doc/library/json.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst index e01faa63f07f93..328a170ae7221d 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -211,9 +211,7 @@ Basic Usage a string (such as ``"\t"``) is used to indent each level. If zero, negative, or ``""`` (the empty string), only newlines are inserted. - If ``None`` (the default), no pretty printing is done, and a - compact representation is used, though a singular space is - still left after the separators. + If ``None`` (the default), no newlines are inserted. :type indent: int | str | None :param separators: From f8f49dc26afe32080f36d98a2aeb0b7fac32fabd Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 19:03:02 +0800 Subject: [PATCH 6/7] Change docstring for dumps as well --- Lib/json/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py index 2953c5cbc13369..59bb74062dc91b 100644 --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -206,9 +206,9 @@ def dumps(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True, If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent - level of 0 will only insert newlines. ``None`` is the most compact - representation. - + level of 0 will only insert newlines. ``None`` gives a compact + representation; see below. + If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON From c8b2cd06ca3e87b00e3330c8fa724e308c00d388 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 20:11:05 +0800 Subject: [PATCH 7/7] Remove trailing whitespace --- Lib/json/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py index 59bb74062dc91b..28525539150039 100644 --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -208,7 +208,7 @@ def dumps(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True, object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` gives a compact representation; see below. - + If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON