Repository navigation
Accept JSON encoder keyword arguments and normalize initial indentation - #9459
Conversation
Match CPython encoder_new/encoder_call keyword names and negative initial indentation prefix behavior. Refresh the complete speedups test module through update_lib after scoped canonical and oracle validation. Assisted-by: OpenAI Codex: model version unavailable
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Use structs for encoder arguments crates/stdlib/src/json.rs |
The constructor and call method use argument structs. The call method clamps negative indent values to zero before encoding. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers: youknowone
Merge Risk: 
Minimal · up to 3ec21
-
The encoder changes support the expected keyword arguments while preserving positional calls. No actionable merge-blocking issue was identified; current-head CI should pass before merging.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title names two changes that the changeset contains: accepting JSON encoder keyword arguments (EncoderArgs and EncoderCallArgs structs replace tuples, with the CPython keyword names) and normalizing the initial indentation (negative indent levels are clamped to zero). The title is specific and matches the primary change in crates/stdlib/src/json.rs. It is slightly long at 71 characters, but it is clear and not vague.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 1 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [x] lib: cpython/Lib/json dependencies:
dependent tests: (21 tests)
Legend:
|
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. |
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
_json.make_encoderandobj/_current_indent_levelin encoder calls, while preserving positional arguments.test_json/test_speedups.pythroughscripts/update_libfrom the pinned CPython source.CPython basis
Pinned source:
d220409a13b77de7a6c30abe16ea90db01528edc.The integer digit-limit work in #8087 is independent and is not duplicated here. Generic argument-binding error wording and inherited constructor validation precedence are not changed.
Verification
Scoped check and strict Clippy passed. A bounded CLI build timed out during code generation; the same command then completed successfully using its cached dependencies. The resulting protected binary passed:
test_speedupsmethods in both RustPython and pinned CPython, with zero failures, errors, skips or expected failures.__index__callbacks.scripts/update_lib migrate; its bytes match the pinned canonical source used by validation.Validation used base
95bf39a54b67df408db9da53cfc546e711c93895. The branch was subsequently fast-forwarded tobcaa07a7d843c2a027bfb5773b56f1b8601ca33b, whose two deque-related files do not overlap this change. The tested native source is byte-identical after that integration and normal commit hooks passed. No new runtime pass is claimed for that final base; current-head CI remains required.The two explicit GC/mutation tests in the module were excluded from local execution. Full workspace/C-API suites, concurrency/GC/stress tests and extreme allocation cases were not run. Generic binder error wording and inherited constructor validation precedence are outside this patch.
AI assistance: OpenAI Codex (model version unavailable).
Summary by CodeRabbit