-
Notifications
You must be signed in to change notification settings - Fork 2k
String ending with octal causes panic when UP012 selected #24389
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Ruff panics on a valid Python file containing this line:
IMR_HEADER = "$IMURAW\0".encode("ascii")File to reproduce it
# SPDX-FileCopyrightText: Aresys S.r.l. <info@aresys.it>
# SPDX-License-Identifier: MIT
"""Test."""
IMR_HEADER = "$IMURAW\0".encode("ascii")Command used
python -m ruff check tmp_repro.py
Observed output:
1:1 panic: Panicked at crates/ruff_python_trivia/src/cursor.rs:170:41 ...
byte index 1 is out of bounds ...
Ruff version:
ruff 0.15.9
This is valid Python and runs correctly. Replacing it with:
IMR_HEADER = b"$IMURAW\x00"works around the issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rule