Skip to content

UP032 fix misinterprets \N escape sequence as interpolation #19771

@dscorbett

Description

@dscorbett

Summary

The fix for f-string (UP032) can introduce a syntax error by misinterpreting a \N escape sequence. Example:

$ cat >up032.py <<'# EOF'
"\N{angle}AOB = {angle}°".format(angle=180)
# EOF

$ ruff --isolated check up032.py --select UP032 --diff 2>&1 | grep error: 
error: Fix introduced a syntax error. Reverting all changes.

Version

ruff 0.12.7 (c5ac998 2025-07-29)

Metadata

Metadata

Assignees

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