-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Rule RET505 cause panic #10099
Comments
👍 That hard line break causes that panic situation. Haven't had time to dig deeper into what causes this. I'm getting the following when trying to fix the file (ruff cli): panicked at crates/ruff_python_trivia/src/textwrap.rs:172:52:
byte index 18446744073709551604 is out of bounds of `\ |
Update:
that we try to unsafe subtraction, and therefore Rust panics with overflow error. However, the calling function (dedent_to, textwrap.rs) indicates that it panics in the following case: /// # Panics
/// If the first line is indented by less than the provided indent.
pub fn dedent_to(text: &str, indent: &str) -> String { Instead of panicking, we should cleanly shut down with a proper error message. The problem occurs on the following line (155) in let dedent_len = existing_indent_len - indent.len(); Here some debug prints about the used variables: INPUT TEXT: "\\\n Branch = hv.streams.Stream.define(\"branch\", branch=None)"
INDENT: " "
EXISTING INDENT LEN: 0
INDENT LEN: 12 |
Still panics with ruff 0.4.6 file content:
error
|
ruff 0.2.2 (also happens with 0.3.5)
(latest changes from main branch)
file content:
error
python_compressed.zip
The text was updated successfully, but these errors were encountered: