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. <[email protected]>
# 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.
Ruff panics on a valid Python file containing this line:
File to reproduce it
Command used
python -m ruff check tmp_repro.pyObserved output:
Ruff version:
ruff 0.15.9
This is valid Python and runs correctly. Replacing it with:
works around the issue.