Skip to content

PLE2510, PLE2512, PLE2513, PLE2514, and PLE2515 fixes add escape sequences to raw strings #13294

@dscorbett

Description

@dscorbett

The fixes for PLE2510, PLE2512, PLE2513, PLE2514, and PLE2515 add escape sequences to raw strings, which is an invalid change because raw strings don’t support escape sequences. The fixes should convert the raw strings to normal strings first.

$ ruff --version
ruff 0.6.4
$ printf 'print(r"""\x08\x1a\x1b\x00\xe2\x80\x8b\n""")\n' >ple251.py
$ python3.10 ple251.py | xxd -p
081a1b0a
$ ruff check --isolated --select PLE251 ple251.py --fix
Found 5 errors (5 fixed, 0 remaining).
$ python3.10 ple251.py
\b\x1A\x1B\0\u200b

I’m using Python 3.10 for this example because literal null characters are syntax errors in later versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixesRelated to suggested fixes for violationshelp wantedContributions especially welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions