ruff
f83e48ca - [`pylint`] Avoid syntax errors in invalid character replacements in f-strings before Python 3.12 (`PLE2510`, `PLE2512`, `PLE2513`, `PLE2514`, `PLE2515`) (#25544)

Commit
55 days ago
[`pylint`] Avoid syntax errors in invalid character replacements in f-strings before Python 3.12 (`PLE2510`, `PLE2512`, `PLE2513`, `PLE2514`, `PLE2515`) (#25544) ## Summary Fixes #18816. When a raw control character appears inside an f-string replacement field or format spec, replacing it with an escape sequence can introduce invalid pre-3.12 syntax. This keeps the diagnostic, but suppresses the fix for interpolated f-string/t-string elements when the target version is older than Python 3.12. Literal f-string text and Python 3.12+ targets keep the existing fix behavior. ## Test plan - `cargo test -p ruff_linter --features test-rules invalidcharacter` - `cargo test -p ruff_linter --features test-rules rules::pylint::tests::invalid_characters_pre_py312` - `cargo fmt --check` - `git diff --check` --------- Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
Author
Parents
Loading