GeezerVison is showing github.com — Add more number functions to c-api by bschoenmaeckers · Pull Request #8158 · RustPython/RustPython
Conversation
bschoenmaeckers
commented
Jun 24, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary by CodeRabbit
- New Features
- Expanded numeric C-API support with additional newly exported operations for arithmetic, bitwise logic, negation/absolute/inversion, division, power, remainder, and matrix multiplication.
- Added a comprehensive set of in-place numeric operation exports (including in-place bit shifts and power) for update-style calculations.
- Introduced enhanced numeric/index checking and conversion helpers (e.g., float/long) to improve C-API interoperability.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Jun 24, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: a57e4cf9-e592-4feb-b133-75fabfbbde93
📥 Commits
Reviewing files that changed from the base of the PR and between 98b64de and 0822ca9.
📒 Files selected for processing (1)
crates/capi/src/abstract_/number.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- crates/capi/src/abstract_/number.rs
📝 Walkthrough
Walkthrough
crates/capi/src/abstract_/number.rs adds C-API wrappers for numeric checks, conversions, standard arithmetic and bitwise operations, and in-place numeric operations, all forwarding into the RustPython VM PyNumber protocol.
Changes
PyNumber C-API wrapper expansion
| Layer / File(s) |
Summary |
Imports, checks, and conversion wrappers crates/capi/src/abstract_/number.rs |
Adds c_int and PyNumber protocol imports; exports PyIndex_Check, PyNumber_Check, PyNumber_Float, PyNumber_Long, and retained PyNumber_Index, all delegating to VM check/conversion methods. |
Standard numeric wrappers crates/capi/src/abstract_/number.rs |
Exports PyNumber_Add, PyNumber_Absolute, PyNumber_Divmod, PyNumber_FloorDivide, PyNumber_Invert, PyNumber_MatrixMultiply, PyNumber_Multiply, PyNumber_Negative, PyNumber_Positive, PyNumber_Power, PyNumber_Remainder, PyNumber_TrueDivide, and PyNumber_Xor, each delegating to the corresponding PyNumber VM method. |
In-place numeric wrappers crates/capi/src/abstract_/number.rs |
Exports PyNumber_InPlaceAdd, PyNumber_InPlaceAnd, PyNumber_InPlaceFloorDivide, PyNumber_InPlaceLshift, PyNumber_InPlaceMatrixMultiply, PyNumber_InPlaceMultiply, PyNumber_InPlaceOr, PyNumber_InPlacePower, PyNumber_InPlaceRemainder, PyNumber_InPlaceRshift, PyNumber_InPlaceSubtract, PyNumber_InPlaceTrueDivide, and PyNumber_InPlaceXor, each delegating to the _i* VM method. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
🐇 Hop, hop, the numbers now flow,
Checks and conversions put on a show.
Add, mul, xor, and powers in place,
The VM hums along at a steady pace.
A rabbit applauds with twitchy delight,
For C-API wrappers now leap just right.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name |
Status |
Explanation |
| Description Check |
✅ Passed |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
✅ Passed |
The title accurately summarizes the main change: additional numeric C-API functions were added. |
| Docstring Coverage |
✅ Passed |
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Linked Issues check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
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.
|
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.
|