Skip to content

Commit 4cee810

Browse files
committed
#16476: merge with 3.2.
2 parents 1e86d01 + b32512e commit 4cee810

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

Lib/json/tool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def main():
3131
except ValueError as e:
3232
raise SystemExit(e)
3333
with outfile:
34-
json.dump(obj, outfile, sort_keys=True, indent=4)
34+
json.dump(obj, outfile, sort_keys=True,
35+
indent=4, separators=(',', ': '))
3536
outfile.write('\n')
3637

3738

Lib/test/json_tests/test_tool.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ class TestTool(unittest.TestCase):
1919
[
2020
[
2121
"blorpie"
22-
],
22+
],
2323
[
2424
"whoops"
25-
],
26-
[],
27-
"d-shtaeou",
28-
"d-nthiouh",
29-
"i-vhbjkhnth",
25+
],
26+
[],
27+
"d-shtaeou",
28+
"d-nthiouh",
29+
"i-vhbjkhnth",
3030
{
3131
"nifty": 87
32-
},
32+
},
3333
{
34-
"field": "yes",
34+
"field": "yes",
3535
"morefield": false
3636
}
3737
]

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ Core and Builtins
9696
Library
9797
-------
9898

99+
- Issue #16476: Fix json.tool to avoid including trailing whitespace.
100+
99101
- Issue #16549: Make json.tool work again on Python 3 and add tests.
100102
Initial patch by Berker Peksag and Serhiy Storchaka.
101103

0 commit comments

Comments
 (0)