From cad0af2aae4eda11aafca9323292629391fbf079 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Fri, 6 Jul 2018 16:48:47 +0900 Subject: [PATCH 1/3] bpo-23493: json: Optimize sort_keys in Python encoder Stop using key=lambda idiom. This behavior is same to C version encoder. --- Lib/json/encoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py index fb083ed61bb1f8..2d7b8989c711da 100644 --- a/Lib/json/encoder.py +++ b/Lib/json/encoder.py @@ -350,7 +350,7 @@ def _iterencode_dict(dct, _current_indent_level): 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: From 452d5c286830913172b38e1b512a2034230ca6e9 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Fri, 6 Jul 2018 16:52:12 +0900 Subject: [PATCH 2/3] Add news --- .../NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst diff --git a/Misc/NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst b/Misc/NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst new file mode 100644 index 00000000000000..1b167d3df139dc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst @@ -0,0 +1 @@ +Optimize ``sort_keys`` option of pure Python JSON encoder. From 5d41abd16d558f78a91a04902a1a6700fdb834f0 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Sat, 7 Jul 2018 02:20:44 +0900 Subject: [PATCH 3/3] Remove news --- .../NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst diff --git a/Misc/NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst b/Misc/NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst deleted file mode 100644 index 1b167d3df139dc..00000000000000 --- a/Misc/NEWS.d/next/Library/2018-07-06-16-52-08.bpo-23493.xAuPmu.rst +++ /dev/null @@ -1 +0,0 @@ -Optimize ``sort_keys`` option of pure Python JSON encoder.