Skip to content

ISC001 fix can modify octal escape sequences #12936

@dscorbett

Description

@dscorbett

The fix for ISC001 changes behavior when the first string ends with a one- or two-digit octal escape sequence and the second begins with an octal digit.

$ ruff --version
ruff 0.6.0
$ cat isc001.py
print("\12""0")
$ python isc001.py

0
$ ruff check --isolated --select ISC001 isc001.py --fix
Found 1 error (1 fixed, 0 remaining).
$ python isc001.py
P

The least disruptive fix would be to detect this specific situation and pad the escape sequence to three digits. In the above example, that would result in "\0120".

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