Skip to content

Encode nonfinite Decimal values as null in JSON number mode - #1226

Open
mikamikasuki wants to merge 1 commit into
msgspec:mainfrom
mikamikasuki:fix/json-nonfinite-decimal-826
Open

mikamikasuki wants to merge 1 commit into
msgspec:mainfrom
mikamikasuki:fix/json-nonfinite-decimal-826

Conversation

@mikamikasuki

Copy link
Copy Markdown

Problem: decimal_format="number" emits invalid JSON for nonfinite Decimal values in #826.

Fix: Encode these values as null, matching nonfinite float handling. Preserve finite Decimal precision and string/callable formats.

Validation: just test-all passed (6,512 unit tests and 7 doctests); just check passed. Regression coverage includes infinity, signed NaN, signaling NaN, and NaN payloads in number and string modes.

Fixes #826

This branch has not been deployed

No deployments
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.

Inconsistent behavior serializing python numbers and decimals

1 participant