]> granicus.if.org Git - python/commitdiff
bpo-23493: json: Change sort_keys in Python encoder same to C (GH-8131)
authorINADA Naoki <methane@users.noreply.github.com>
Fri, 6 Jul 2018 23:55:03 +0000 (08:55 +0900)
committerGitHub <noreply@github.com>
Fri, 6 Jul 2018 23:55:03 +0000 (08:55 +0900)
Stop using key=lambda.  This behavior is same to C version encoder.

Lib/json/encoder.py

index fb083ed61bb1f8b83b26aa69bd89411dddf4e75a..2d7b8989c711daf8168412277b7dbed252783618 100644 (file)
@@ -350,7 +350,7 @@ def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
             item_separator = _item_separator
         first = True
         if _sort_keys:
-            items = sorted(dct.items(), key=lambda kv: kv[0])
+            items = sorted(dct.items())
         else:
             items = dct.items()
         for key, value in items: