[Python-checkins] bpo-32360: Remove OrderedDict usage from json.tool (GH-5315)
INADA Naoki
webhook-mailer at python.org
Thu Jan 25 05:53:02 EST 2018
https://github.com/python/cpython/commit/2812d3d99287c50bab99625d7240bcf1c2e32369
commit: 2812d3d99287c50bab99625d7240bcf1c2e32369
branch: master
author: INADA Naoki <methane at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-01-25T19:52:58+09:00
summary:
bpo-32360: Remove OrderedDict usage from json.tool (GH-5315)
`object_pairs_hook=OrderedDict` idiom is deprecated.
files:
M Lib/json/tool.py
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index 4f3182c0c1e..5932f4ecded 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -11,7 +11,6 @@
"""
import argparse
-import collections
import json
import sys
@@ -34,11 +33,7 @@ def main():
sort_keys = options.sort_keys
with infile:
try:
- if sort_keys:
- obj = json.load(infile)
- else:
- obj = json.load(infile,
- object_pairs_hook=collections.OrderedDict)
+ obj = json.load(infile)
except ValueError as e:
raise SystemExit(e)
with outfile:
More information about the Python-checkins
mailing list