-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update some tests from 3.13.7 #6108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughUpdates ignore patterns in .gitignore. Adjusts unicodedata::name to emit a different ValueError message when no name is found with a default provided. Removes the Python-exposed is_integer method from PyInt, retaining an internal const version; bit_count remains unchanged. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.gitignore (1)
24-28
: Clarify ignore depth and anchor patterns for Lib/site-packages and Lib/test/dataIf the intent is to ignore everything under these directories recursively (not just direct children), prefer anchoring to repo root and using
**
. Keeps the single README files tracked.Would you like these patterns to apply recursively? If yes, apply:
-Lib/site-packages/* -!Lib/site-packages/README.txt -Lib/test/data/* -!Lib/test/data/README +/Lib/site-packages/** +!/Lib/site-packages/README.txt +/Lib/test/data/** +!/Lib/test/data/README
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (35)
Lib/test/data/README
is excluded by!Lib/**
Lib/test/dtracedata/assert_usable.d
is excluded by!Lib/**
Lib/test/dtracedata/assert_usable.stp
is excluded by!Lib/**
Lib/test/dtracedata/call_stack.d
is excluded by!Lib/**
Lib/test/dtracedata/call_stack.d.expected
is excluded by!Lib/**
Lib/test/dtracedata/call_stack.py
is excluded by!Lib/**
Lib/test/dtracedata/call_stack.stp
is excluded by!Lib/**
Lib/test/dtracedata/call_stack.stp.expected
is excluded by!Lib/**
Lib/test/dtracedata/gc.d
is excluded by!Lib/**
Lib/test/dtracedata/gc.d.expected
is excluded by!Lib/**
Lib/test/dtracedata/gc.py
is excluded by!Lib/**
Lib/test/dtracedata/gc.stp
is excluded by!Lib/**
Lib/test/dtracedata/gc.stp.expected
is excluded by!Lib/**
Lib/test/dtracedata/instance.py
is excluded by!Lib/**
Lib/test/dtracedata/line.d
is excluded by!Lib/**
Lib/test/dtracedata/line.d.expected
is excluded by!Lib/**
Lib/test/dtracedata/line.py
is excluded by!Lib/**
Lib/test/pythoninfo.py
is excluded by!Lib/**
Lib/test/site-packages/README.txt
is excluded by!Lib/**
Lib/test/support/hypothesis_helper.py
is excluded by!Lib/**
Lib/test/test_binascii.py
is excluded by!Lib/**
Lib/test/test_cmath.py
is excluded by!Lib/**
Lib/test/test_contextlib.py
is excluded by!Lib/**
Lib/test/test_hashlib.py
is excluded by!Lib/**
Lib/test/test_long.py
is excluded by!Lib/**
Lib/test/test_math.py
is excluded by!Lib/**
Lib/test/test_math_property.py
is excluded by!Lib/**
Lib/test/test_opcache.py
is excluded by!Lib/**
Lib/test/test_optparse.py
is excluded by!Lib/**
Lib/test/test_property.py
is excluded by!Lib/**
Lib/test/test_ucn.py
is excluded by!Lib/**
Lib/test/test_unicodedata.py
is excluded by!Lib/**
Lib/test/translationdata/argparse/msgids.txt
is excluded by!Lib/**
Lib/test/translationdata/getopt/msgids.txt
is excluded by!Lib/**
Lib/test/translationdata/optparse/msgids.txt
is excluded by!Lib/**
📒 Files selected for processing (3)
.gitignore
(1 hunks)stdlib/src/unicodedata.rs
(1 hunks)vm/src/builtins/int.rs
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.rs
: Follow the default rustfmt code style (cargo fmt
to format)
Always run clippy to lint code (cargo clippy
) before completing tasks. Fix any warnings or lints that are introduced by your 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:
stdlib/src/unicodedata.rs
vm/src/builtins/int.rs
🧬 Code graph analysis (1)
vm/src/builtins/int.rs (2)
compiler/literal/src/float.rs (1)
is_integer
(25-27)vm/src/builtins/float.rs (1)
is_integer
(480-482)
⏰ 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). (11)
- GitHub Check: Run snippets and cpython tests on wasm-wasi
- GitHub Check: Check the WASM package and demo
- GitHub Check: Run snippets and cpython tests (ubuntu-latest)
- GitHub Check: Run tests under miri
- GitHub Check: Run snippets and cpython tests (macos-latest)
- GitHub Check: Run snippets and cpython tests (windows-latest)
- GitHub Check: Check Rust code with rustfmt and clippy
- GitHub Check: Run rust tests (windows-latest)
- GitHub Check: Run rust tests (ubuntu-latest)
- GitHub Check: Run rust tests (macos-latest)
- GitHub Check: Ensure compilation on various targets
🔇 Additional comments (2)
stdlib/src/unicodedata.rs (1)
148-149
: LGTM: ValueError message updated to match CPython behaviorReturning the provided default when no name is found, and otherwise raising
ValueError("no such name")
aligns with CPython’s expectations forunicodedata.name
.vm/src/builtins/int.rs (1)
693-693
: bit_count remains correctly exposed
bit_count()
implementation is consistent with Python’s API and semantics.
const fn is_integer(&self) -> bool { | ||
true | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Do not expose int.is_integer()
to Python
int
in CPython does not have an is_integer()
method; exposing it breaks compatibility and likely contradicts the updated tests. If you need this helper internally, keep it as a non-#[pymethod]
function in a non-pyclass impl block; otherwise, remove it.
Apply this diff to stop exporting it to Python:
- #[pymethod]
- const fn is_integer(&self) -> bool {
- true
- }
Optionally, if an internal helper is desired elsewhere in the crate, add (outside the #[pyclass] impl
):
impl PyInt {
pub const fn is_integer(&self) -> bool {
true
}
}
Run to confirm nothing else exposes is_integer
for int
:
🏁 Script executed:
#!/bin/bash
# grep for Python-visible int.is_integer definitions/usages
rg -n --type=rust -C2 '(?m)^\s*#\s*\[pymethod\]\s*\n\s*const?\s+fn\s+is_integer\b' vm/src
rg -n --type=python -C2 "hasattr\\([^,]+,\\s*['\\\"]is_integer['\\\"]\\)" Lib/test || true
Length of output: 501
To ensure we didn’t miss any Python-exposed is_integer
methods or references, let’s rerun with a corrected regex:
🏁 Script executed:
#!/bin/bash
# Search for any #[pymethod] const fn is_integer in Rust
rg -n -U --type=rust '#\[pymethod\]\s*const\s+fn\s+is_integer' vm/src
# Search for any usage of .is_integer() in Python tests
rg -n --type=python '\.is_integer\s*\(' Lib/test
Length of output: 264
Remove Python exposure of int.is_integer()
The #[pymethod] const fn is_integer(&self) -> bool { … }
on lines 688–689 of vm/src/builtins/int.rs
is still being exposed to Python. In CPython, int
has no is_integer()
method, so this breaks compatibility.
Please apply the following diff to stop exporting it:
--- a/vm/src/builtins/int.rs
+++ b/vm/src/builtins/int.rs
@@ impl PyInt {
- #[pymethod]
- const fn is_integer(&self) -> bool {
- true
- }
If you still need this helper internally, add it outside the #[pyclass] impl
as a plain Rust method:
impl PyInt {
pub const fn is_integer(&self) -> bool {
true
}
}
🤖 Prompt for AI Agents
In vm/src/builtins/int.rs around lines 689–692, the const fn is_integer(&self)
is currently exposed to Python via #[pymethod] inside the #[pyclass] impl which
is incompatible with CPython; remove the #[pymethod] export (delete the method
from the pyclass impl) and, if the functionality is still needed internally, add
a plain Rust method on PyInt outside the #[pyclass] impl (e.g., impl PyInt { pub
const fn is_integer(&self) -> bool { true } }) so it is available in Rust but
not exported to Python.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I can split this PR if it's too big
Summary by CodeRabbit