-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-132021: Add bool type to the list of allowed JSON key types #132048
Conversation
srinivasreddy
commented
Apr 3, 2025
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Inconsistency in json.JSONEncoder Description Regarding skipkeys Behavior #132021
… in keys of encode(...) method
Hi! This updates the docstring for |
Lib/json/encoder.py
Outdated
@@ -108,7 +108,7 @@ def __init__(self, *, skipkeys=False, ensure_ascii=True, | |||
"""Constructor for JSONEncoder, with sensible defaults. | |||
|
|||
If skipkeys is false, then it is a TypeError to attempt | |||
encoding of keys that are not str, int, float or None. If | |||
encoding of keys that are not bool, str, int, float or None. If |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: json.dumps
uses the order "str
, int
, float
, bool
, None
" in its docstring and docs, so we might as well use the same order here for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Thanks @srinivasreddy for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Thanks @srinivasreddy for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
…ythonGH-132048) (cherry picked from commit 403886c) Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <[email protected]> Co-authored-by: Eric V. Smith <[email protected]>
…ythonGH-132048) (cherry picked from commit 403886c) Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <[email protected]> Co-authored-by: Eric V. Smith <[email protected]>
GH-132255 is a backport of this pull request to the 3.13 branch. |
GH-132256 is a backport of this pull request to the 3.12 branch. |
…GH-132048) (#132256) gh-132021: Add bool type to the list of allowed JSON key types (GH-132048) (cherry picked from commit 403886c) Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <[email protected]> Co-authored-by: Eric V. Smith <[email protected]>
…GH-132048) (#132255) gh-132021: Add bool type to the list of allowed JSON key types (GH-132048) (cherry picked from commit 403886c) Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <[email protected]> Co-authored-by: Eric V. Smith <[email protected]>