-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
Summary
match_continuation does not recognize U+000C FORM FEED as white space. That makes the fix for runtime-import-in-type-checking-block (TC004) ignore a line continuation character after a form feed after a TYPE_CHECKING import, introducing a syntax error. Example:
$ cat >tc004.py <<'# EOF'
from typing import TYPE_CHECKING\
if TYPE_CHECKING: import builtins
builtins.print("!")
# EOF
$ ruff --isolated check tc004.py --select TC004 --unsafe-fixes --diff 2>&1 | grep error:
error: Fix introduced a syntax error. Reverting all changes.There is a form feed before the backslash in that example. Some browsers hide control characters. Hopefully it’s still there if you copy and paste it.
Version
ruff 0.12.2 (9bee837 2025-07-03)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations