]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#16476: Fix json.tool to avoid including trailing whitespace.
authorEzio Melotti <ezio.melotti@gmail.com>
Thu, 29 Nov 2012 00:22:49 +0000 (02:22 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Thu, 29 Nov 2012 00:22:49 +0000 (02:22 +0200)
Lib/json/tests/test_tool.py
Lib/json/tool.py
Misc/NEWS

index 679ae83546763163770b8b70c1d81d909a5b70b8..b5d4fca4fa3c1ef4752cfc9de301f95c4b512700 100644 (file)
@@ -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
         }
     ]
index 9ec34401ee5c6fa0d07b89d1784af223c2d3c6b6..fe47c52d41631df324250616153f38968d3004fe 100644 (file)
@@ -31,7 +31,8 @@ def main():
         except ValueError, 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')
 
 
index 7af9a68dcd7e3ded6b7b96b96647beb224c3eaa3..55bed5083ae32110cd26230fb6ba5174481fff64 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -154,6 +154,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #16476: Fix json.tool to avoid including trailing whitespace.
+
 - Issue #1160: Fix compiling large regular expressions on UCS2 builds.
   Patch by Serhiy Storchaka.