Skip to content

Document the parse_constant -NaN caveat in load/loads/parse docstrings - #157

Merged
dpranke merged 1 commit into
dpranke:mainfrom
rahul05ranjan:doc-parse-constant-caveat
Nov 2, 2026
Merged

dpranke merged 1 commit into
dpranke:mainfrom
rahul05ranjan:doc-parse-constant-caveat

Conversation

@rahul05ranjan

Copy link
Copy Markdown
Contributor

Follow-up to #152.

As discussed there, the parse_constant hook contract genuinely differs from the json module's because -NaN is 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_constant bullet to the parameter lists in load() and loads() (right after the existing parse_int caveat), and extends parse()'s lettered difference list from (d)–(e) to cover it.

No behavior changes — docstrings only.

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>

@dpranke dpranke left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@dpranke
dpranke merged commit aed458c into dpranke:main Nov 2, 2026
9 checks passed
@rahul05ranjan

Copy link
Copy Markdown
Contributor Author

Thanks for the merge! Glad the docstrings make the parse_constant caveat clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants