Skip to content

fix(json): keep integers beyond isize exact - #661

Merged
0x676e67 merged 2 commits into
0x676e67:mainfrom
patrick-immometrica:fix/json-big-int
Nov 9, 2026
Merged

0x676e67 merged 2 commits into
0x676e67:mainfrom
patrick-immometrica:fix/json-big-int

Conversation

@patrick-immometrica

@patrick-immometrica patrick-immometrica commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

stops from turning large integers into floats. Before the fix, integers were stored as Rust isize, so any value outside that range, such as 2**63, became an f64 and lost precision. This happened both in JSON request and response bodies (src/client/body/json.rs) and in query parameters (src/client/param.rs). The fix uses an i64 variant plus a new u64 variant (UInt), so whole numbers from -(2**63) up to 2**64 - 1 now go out and come back exact. A new test sends {"a": 2**63, "b": -(2**63)} as JSON and 2**64 - 1 as a query value to a local server and checks the exact digits on the wire. The response test now expects 2**63 to decode as a Python int, no longer a float.

@0x676e67
0x676e67 merged commit 4425f34 into 0x676e67:main Nov 9, 2026
33 checks passed
@patrick-immometrica
patrick-immometrica deleted the fix/json-big-int branch November 9, 2026 10:05
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