Repository navigation
Document the parse_constant -NaN caveat in load/loads/parse docstrings - #157
Merged
Merged
Conversation
Per the discussion in dpranke#152: the hook contract genuinely differs from the json module because -NaN is legal JSON5, so the docstrings should say so, next to the existing parse_int caveat. Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
This was referenced Nov 2, 2026
Contributor
Author
|
Thanks for the merge! Glad the docstrings make the parse_constant caveat clearer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #152.
As discussed there, the
parse_constanthook contract genuinely differs from thejsonmodule's because-NaNis legal JSON5 and the callback receives the spelling as written — so the code is right and the docstrings are the thing to fix.This adds a
parse_constantbullet to the parameter lists inload()andloads()(right after the existingparse_intcaveat), and extendsparse()'s lettered difference list from(d)–(e)to cover it.No behavior changes — docstrings only.