GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — Update some tests from 3.13.7 by ShaharNaveh · Pull Request #6108 · RustPython/RustPython 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
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 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
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration.
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/**.gitignore (1 hunks)stdlib/src/unicodedata.rs (1 hunks)vm/src/builtins/int.rs (1 hunks)📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.rs: Follow the default rustfmt code style (cargo fmtto 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.rsvm/src/builtins/int.rscompiler/literal/src/float.rs (1)
is_integer(25-27)vm/src/builtins/float.rs (1)
is_integer(480-482)
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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const fn is_integer(&self) -> bool { | ||
| true | ||
| } | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
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 } }
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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.