summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-11-29 00:26:15 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-11-29 00:26:15 (GMT)
commit4cee810f5d0376ba32f893340e9a5fefc1b56e05 (patch)
tree2ac8554fdd8c04db0ef7b51686de4895e377d083
parent1e86d01e1ebca5554c51d18dee404658c14bce00 (diff)
parentb32512ed9a1ab9912a9e0bdbb609ca1a19949355 (diff)
downloadcpython-4cee810f5d0376ba32f893340e9a5fefc1b56e05.zip
cpython-4cee810f5d0376ba32f893340e9a5fefc1b56e05.tar.gz
cpython-4cee810f5d0376ba32f893340e9a5fefc1b56e05.tar.bz2
#16476: merge with 3.2.
-rw-r--r--Lib/json/tool.py3
-rw-r--r--Lib/test/json_tests/test_tool.py16
-rw-r--r--Misc/NEWS2
3 files changed, 12 insertions, 9 deletions
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index 9ab6d65..0f108c6 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -31,7 +31,8 @@ def main():
except ValueError as e:
raise SystemExit(e)
with outfile:
- json.dump(obj, outfile, sort_keys=True, indent=4)
+ json.dump(obj, outfile, sort_keys=True,
+ indent=4, separators=(',', ': '))
outfile.write('\n')
diff --git a/Lib/test/json_tests/test_tool.py b/Lib/test/json_tests/test_tool.py
index 8a3cc6f..1f2c8a2 100644
--- a/Lib/test/json_tests/test_tool.py
+++ b/Lib/test/json_tests/test_tool.py
@@ -19,19 +19,19 @@ class TestTool(unittest.TestCase):
[
[
"blorpie"
- ],
+ ],
[
"whoops"
- ],
- [],
- "d-shtaeou",
- "d-nthiouh",
- "i-vhbjkhnth",
+ ],
+ [],
+ "d-shtaeou",
+ "d-nthiouh",
+ "i-vhbjkhnth",
{
"nifty": 87
- },
+ },
{
- "field": "yes",
+ "field": "yes",
"morefield": false
}
]
diff --git a/Misc/NEWS b/Misc/NEWS
index 20b0e8d..90aee93 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -96,6 +96,8 @@ Core and Builtins
Library
-------
+- Issue #16476: Fix json.tool to avoid including trailing whitespace.
+
- Issue #16549: Make json.tool work again on Python 3 and add tests.
Initial patch by Berker Peksag and Serhiy Storchaka.