Repository navigation
Use the first-key error message in the C scanner - #388
Merged
Merged
Conversation
At the first key position a '}' is still legal, and the pure Python decoder says so. The C scanner raised the after-a-comma wording there, even though the closing-brace check a few lines below already selects on did_parse.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
etrepum
approved these changes
Sep 11, 2026
etrepum
left a comment
Member
There was a problem hiding this comment.
LGTM, pending CI verification
etrepum
pushed a commit
that referenced
this pull request
Oct 2, 2026
Add CHANGES entries for #387, #388 and #390. Test Python 3.15 and 3.15t via allow-prereleases so the jobs follow 3.15.0 final, add PyPy 3.12, move debug and TSan builds to CPython 3.14.8, and bump checkout, setup-python, cache, setup-uv and cibuildwheel. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FpcGq7FDACHqLiW7juM4SK
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Oct 3, 2026
4.2.0 released 2026-10-02 * Start building wheels for Python 3.15 and drop Python 3.8 support via upgrade to cibuildwheel v4.2.0 simplejson/simplejson#385 * Build and test riscv64 Linux wheels on native RISE runners simplejson/simplejson#389 * The C scanner now reports the same error message as the pure Python decoder for an invalid first key in an object simplejson/simplejson#388 * ``int_as_string_bitcount`` now supports thresholds of 64 bits and above (including 128-bit integers) in both the C and pure Python encoders; the C encoder previously rejected them simplejson/simplejson#387 * Circular references introduced through ``for_json()`` or ``_asdict()`` now raise ``ValueError("Circular reference detected")`` instead of recursing without bound simplejson/simplejson#390 * CI now tests Python 3.15 (including free-threaded 3.15t), PyPy 3.12, CPython 3.14.8 debug builds, and uses current GitHub Actions and cibuildwheel v4.2.1 simplejson/simplejson#386
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Oct 13, 2026
4.2.0 released 2026-10-02 * Start building wheels for Python 3.15 and drop Python 3.8 support via upgrade to cibuildwheel v4.2.0 simplejson/simplejson#385 * Build and test riscv64 Linux wheels on native RISE runners simplejson/simplejson#389 * The C scanner now reports the same error message as the pure Python decoder for an invalid first key in an object simplejson/simplejson#388 * ``int_as_string_bitcount`` now supports thresholds of 64 bits and above (including 128-bit integers) in both the C and pure Python encoders; the C encoder previously rejected them simplejson/simplejson#387 * Circular references introduced through ``for_json()`` or ``_asdict()`` now raise ``ValueError("Circular reference detected")`` instead of recursing without bound simplejson/simplejson#390 * CI now tests Python 3.15 (including free-threaded 3.15t), PyPy 3.12, CPython 3.14.8 debug builds, and uses current GitHub Actions and cibuildwheel v4.2.1 simplejson/simplejson#386
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Oct 21, 2026
4.2.0 released 2026-10-02 * Start building wheels for Python 3.15 and drop Python 3.8 support via upgrade to cibuildwheel v4.2.0 simplejson/simplejson#385 * Build and test riscv64 Linux wheels on native RISE runners simplejson/simplejson#389 * The C scanner now reports the same error message as the pure Python decoder for an invalid first key in an object simplejson/simplejson#388 * ``int_as_string_bitcount`` now supports thresholds of 64 bits and above (including 128-bit integers) in both the C and pure Python encoders; the C encoder previously rejected them simplejson/simplejson#387 * Circular references introduced through ``for_json()`` or ``_asdict()`` now raise ``ValueError("Circular reference detected")`` instead of recursing without bound simplejson/simplejson#390 * CI now tests Python 3.15 (including free-threaded 3.15t), PyPy 3.12, CPython 3.14.8 debug builds, and uses current GitHub Actions and cibuildwheel v4.2.1 simplejson/simplejson#386
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.
At the first key position a
}is still legal, so the message should say so — and the pure Python decoder does (decoder.py:176vs:236). The C scanner uses the after-a-comma wording there:_speedups_scan.h:213raisesERR_OBJECT_PROPERTYunconditionally for both the first key and the post-comma key. The closing-brace check 84 lines below it (_speedups_scan.h:297-301) already makes exactly this distinction withdid_parse, andERR_OBJECT_PROPERTY_FIRSTalready exists — this reuses both, so'{'was already correct and only the key branch was missing it.'{unquoted_key: "keys must be quoted"}'isfail3.jsonfrom the JSON Checker suite, already vendored intest_fail.py'sJSONDOCS; the existing test only asserts that it raises, never the message.Verification
mainERR_OBJECT_PROPERTYERR_OBJECT_PROPERTY_FIRSTThe last row is why the test has two after-comma cases:
'{"spam":42,:1}'and'{"spam":42,unquoted_key: 1}'must keep the plain message at position 11.The new test passes on the pure Python path against unmodified
main, so it encodes the reference behaviour rather than my reading of it.Full suite with the fix:
Ran 460 tests ... OK (skipped=59)— which covers both implementations, sincetests/__init__.py:77wraps the suite inNoExtensionTestSuite. Rebuilt with the debug job's own flags (-Wall -Wextra -Wshadow -Wstrict-prototypes -Werror ...): 0 warnings, 0 errors. The hunk adds no declaration, only an expression, so there is no declaration-after-statement concern for the Python 2.7 wheel job — though I could not test that job locally, asAGENTS.mdnotes.Only the message changes; positions and exception types are untouched.
decoder.pyhas emitted the longer string for this input since 2013, andtest_fail.py:148already pins it for'{'.I left
CHANGES.txtalone, since the recent message-parity fixes did too.Disclosure: I used Claude (an AI assistant) while preparing this change.