[Python-checkins] cpython (merge 3.2 -> 3.3): #16476: merge with 3.2.

ezio.melotti python-checkins at python.org
Thu Nov 29 01:27:56 CET 2012


http://hg.python.org/cpython/rev/73a7e6ecd0e1
changeset: 80641:73a7e6ecd0e1
branch: 3.3
parent: 80637:1e2ae5e01963
parent: 80640:6996a53f13ce
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Thu Nov 29 02:26:15 2012 +0200
summary:
 #16476: merge with 3.2.
files:
 Lib/json/tool.py | 3 ++-
 Lib/test/json_tests/test_tool.py | 16 ++++++++--------
 Misc/NEWS | 2 ++
 3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -31,7 +31,8 @@
 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
--- a/Lib/test/json_tests/test_tool.py
+++ b/Lib/test/json_tests/test_tool.py
@@ -19,19 +19,19 @@
 [
 [
 "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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -96,6 +96,8 @@
 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.
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /