https://github.com/python/cpython/commit/79d6d5c6af1112ab4ed65dcc2555be843e56ecbe
commit: 79d6d5c6af1112ab4ed65dcc2555be843e56ecbe
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-09-13T08:12:32Z
summary:

[3.14] gh-135623: Document that json sorts the keys before coercing them to 
strings (GH-156987) (GH-157401)

(cherry picked from commit 64740410909891331eb4e4cbdb14837ff4f8ec64)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

files:
M Doc/library/json.rst

diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index 231654a3a9315f3..3632cec2df72a3b 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -264,6 +264,8 @@ Basic Usage
       into JSON and then back into a dictionary, the dictionary may not equal
       the original one. That is, ``loads(dumps(x)) != x`` if x has non-string
       keys.
+      *sort_keys* sorts the keys before they are coerced to strings,
+      so numeric keys are sorted by value, not by their string representation.
 
 .. function:: load(fp, *, cls=None, object_hook=None, parse_float=None, \
                    parse_int=None, parse_constant=None, \

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to