Skip to content

Conversation

@terryluan12
Copy link
Contributor

@terryluan12 terryluan12 commented Dec 30, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved error message clarity for integer division by zero operations to better inform users about the specific error condition.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 30, 2025

📝 Walkthrough

Walkthrough

The error message in the inner_floordiv function was updated from "integer division by zero" to "integer division or modulo by zero" to more accurately reflect that the error applies to both division and modulo operations. No control flow or logic changes occurred.

Changes

Cohort / File(s) Summary
Error Message Update
crates/vm/src/builtins/int.rs
Updated error message in inner_floordiv from "integer division by zero" to "integer division or modulo by zero" to clarify that the error applies to both division and modulo operations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A message so clear, now updated with care,
Division and modulo, both handled with flair,
No zero allowed in this mathematical dance,
The error now speaks of their shared circumstance!

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'Added doctest tests' is vague and does not reflect the actual change, which is modifying an error message in the integer floor division function. Update the title to accurately describe the main change, such as 'Update floor division error message to include modulo context' or 'Change integer division by zero error message'.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e22091e and c32c31f.

⛔ Files ignored due to path filters (18)
  • Lib/test/test_doctest/__init__.py is excluded by !Lib/**
  • Lib/test/test_doctest/decorator_mod.py is excluded by !Lib/**
  • Lib/test/test_doctest/doctest_aliases.py is excluded by !Lib/**
  • Lib/test/test_doctest/doctest_lineno.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest_errors.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest_no_docstrings.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest_no_doctests.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest_skip.py is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest.py is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest2.py is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest2.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest3.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest4.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest_errors.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest_skip.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest_skip2.txt is excluded by !Lib/**
📒 Files selected for processing (1)
  • crates/vm/src/builtins/int.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.rs: Follow the default rustfmt code style by running cargo fmt to format Rust code
Always run clippy to lint code (cargo clippy) before completing tasks and fix any warnings or lints introduced by changes
Follow Rust best practices for error handling and memory management
Use the macro system (pyclass, pymodule, pyfunction, etc.) when implementing Python functionality in Rust

Files:

  • crates/vm/src/builtins/int.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Run rust tests (ubuntu-latest)
  • GitHub Check: Run rust tests (macos-latest)
  • GitHub Check: Run rust tests (windows-latest)
  • GitHub Check: Run snippets and cpython tests on wasm-wasi
  • GitHub Check: Check Rust code with clippy
  • GitHub Check: Ensure compilation on various targets
  • GitHub Check: Check the WASM package and demo

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/vm/src/builtins/int.rs (1)

130-136: Error message in inner_floordiv matches CPython behavior; however, inner_mod has an inconsistent error message.

The error message "integer division or modulo by zero" in inner_floordiv is correct—CPython uses this exact message for both floor division (//) and modulo (%) operations with integers. However, inner_mod (line 124) uses "integer modulo by zero", which differs from CPython's behavior and is inconsistent with inner_floordiv and inner_divmod.

Update inner_mod to use "integer division or modulo by zero" for consistency with CPython and the other integer division-related functions.

Note: The PR title mentions "Added doctest tests" but no doctest additions are visible in this diff.

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e22091e and c32c31f.

⛔ Files ignored due to path filters (18)
  • Lib/test/test_doctest/__init__.py is excluded by !Lib/**
  • Lib/test/test_doctest/decorator_mod.py is excluded by !Lib/**
  • Lib/test/test_doctest/doctest_aliases.py is excluded by !Lib/**
  • Lib/test/test_doctest/doctest_lineno.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest_errors.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest_no_docstrings.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest_no_doctests.py is excluded by !Lib/**
  • Lib/test/test_doctest/sample_doctest_skip.py is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest.py is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest2.py is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest2.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest3.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest4.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest_errors.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest_skip.txt is excluded by !Lib/**
  • Lib/test/test_doctest/test_doctest_skip2.txt is excluded by !Lib/**
📒 Files selected for processing (1)
  • crates/vm/src/builtins/int.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.rs: Follow the default rustfmt code style by running cargo fmt to format Rust code
Always run clippy to lint code (cargo clippy) before completing tasks and fix any warnings or lints introduced by changes
Follow Rust best practices for error handling and memory management
Use the macro system (pyclass, pymodule, pyfunction, etc.) when implementing Python functionality in Rust

Files:

  • crates/vm/src/builtins/int.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Run rust tests (ubuntu-latest)
  • GitHub Check: Run rust tests (macos-latest)
  • GitHub Check: Run rust tests (windows-latest)
  • GitHub Check: Run snippets and cpython tests on wasm-wasi
  • GitHub Check: Check Rust code with clippy
  • GitHub Check: Ensure compilation on various targets
  • GitHub Check: Check the WASM package and demo

Copy link
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@youknowone youknowone merged commit cd012f9 into RustPython:main Dec 31, 2025
13 checks passed
@terryluan12 terryluan12 deleted the update_simple_packages_1 branch January 5, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants