]> granicus.if.org Git - python/commitdiff
bpo-32360: Remove OrderedDict usage from json.tool (GH-5315)
authorINADA Naoki <methane@users.noreply.github.com>
Thu, 25 Jan 2018 10:52:58 +0000 (19:52 +0900)
committerGitHub <noreply@github.com>
Thu, 25 Jan 2018 10:52:58 +0000 (19:52 +0900)
`object_pairs_hook=OrderedDict` idiom is deprecated.

Lib/json/tool.py

index 4f3182c0c1e7f11396e252f435fd6e63c4975a0d..5932f4ecded7eb12f32069bd2cafc0f5191b01af 100644 (file)
@@ -11,7 +11,6 @@ Usage::
 
 """
 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: