Repository navigation
Validate number_mode in load and Decoder - #244
Open
ryanduguid wants to merge 1 commit into
Open
ryanduguid wants to merge 1 commit into
ryanduguid wants to merge 1 commit into
Conversation
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.
Summary
load()andDecoder()acceptnumber_mode=1.0without an error, and theirintconversion can accept out-of-range integers on Linux. Reuse the existing validator used byloads()to reject these inputs before decoding, with 102 regression cases covering all six decoding routes, constructor-only rejection and stream preservation.Evidence
pytest tests: 1,033 passed, 17 skipped and two expected failures on Windows Python 3.13 and Linux Python 3.13, 3.14 and 3.15.0rc3. Linux Python 3.10 reports 1,039 passed with the same skips and expected failures.stubtest rapidjsonpasses on Windows Python 3.13 and Linux Python 3.13, 3.14 and 3.15.0rc3.Merge danger
Door: two-way. Blast radius: parser options.
Invalid types now raise
TypeError, and oversized integers raiseValueError. Forload()andDecoder(), the invalid-integer message changes fromInvalid number_modetoInvalid number_mode, out of range; callers matching the old exact text would need to adjust. The existing unsupportedNM_NATIVE | NM_DECIMALerror text is retained.Unverified
Hosted CI, debug Python, macOS, other wheel architectures, stable Python 3.15, sanitisers and benchmarks are unverified. Python 3.10 doctests/stubtest and Python 3.15rc3 doctests were not run; the current full test requirements require a newer Python than 3.10. Paired Python 3.14 doctest runs have the same single native-integer representation failure on the unchanged base and candidate. Its cause is unverified. Stale Python 3.9 tox checks were not run because the package requires Python 3.10+. No lint command is configured.