GeezerVison is showing github.com — Align CallFunctionEx to 3.14 by youknowone · Pull Request #6786 · RustPython/RustPython
Conversation
youknowone
commented
Jan 18, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary by CodeRabbit
- Refactor
- Internal optimizations to function call handling and bytecode processing for improved code efficiency and simplified control flow.
✏️ Tip: You can customize this high-level summary in your review settings.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Jan 18, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
📝 Walkthrough
Walkthrough
The PR simplifies keyword argument handling in function calls by removing a per-call has_kwargs flag from the CallFunctionEx bytecode instruction. Instead, the system now relies on stack state: when kwargs are absent, a Null value is pushed onto the stack, enabling uniform CallFunctionEx invocation logic across compiler and VM execution layers.
Changes
| Cohort / File(s) |
Summary |
CallFunctionEx Instruction Simplification crates/compiler-core/src/bytecode/instruction.rs |
Changed CallFunctionEx enum variant from struct-like with has_kwargs: Arg<bool> field to unit-like variant CallFunctionEx = 54. Updated stack-effect computation to use fixed value instead of variable logic. Simplified display/formatting code. |
Compiler Codegen Updates crates/codegen/src/compile.rs |
Replaced conditional has_kwargs presence checks with direct branching: compiles kwargs via compile_keywords(...) when present, or pushes Null when absent. Removed has_kwargs parameter passing to CallFunctionEx emission calls. |
VM Frame Execution Updates crates/vm/src/frame.rs |
Updated CallFunctionEx instruction dispatch to remove has_kwargs deconstruction. Changed collect_ex_args signature from flag-driven to stack-driven via pop_value_opt. Added iterate_mapping_keys helper to preserve key order when extracting kwargs from mapping objects. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
- Sort
Instruction enum & related match arms #6322: Both PRs modify the Instruction::CallFunctionEx shape and its handling throughout the codebase, with this PR removing the per-call has_kwargs field entirely.
- Replace CallMethod/LoadMethod opcodes with plain Call #6674: Both PRs modify CallFunctionEx opcode and call-handling paths; the referenced PR introduced centralized CallFunctionEx with has_kwargs, while this PR removes the flag and converts to stack-driven kwargs via PushNull.
- Pseudo ops #6678: Both PRs touch the CallFunctionEx and kwargs codepath, modifying how keyword arguments are represented and handled across compiler and VM layers.
Suggested reviewers
Poem
🐰 No more flags upon the stack, just Nulls to light the way,
Where kwargs once were whispered true, now silence wins the day,
The CallFunctionEx hops along, so simple and so clean,
From flag-driven dreams to stack-based streams—the best refactor seen! ✨
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
⚠️ Warning |
Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (2 passed)
| Check name |
Status |
Explanation |
| Description Check |
✅ Passed |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
✅ Passed |
The title 'Align CallFunctionEx to 3.14' directly corresponds to the main refactoring described in all three modified files: removing the per-call has_kwargs flag from CallFunctionEx and aligning its behavior. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
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.
❤️ Share
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.