-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Unexpected whitespace handling in f-string !r #93283
Copy link
Copy link
Closed
Labels
3.10only security fixesonly security fixes3.11only security fixesonly security fixes3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Metadata
Metadata
Assignees
Labels
3.10only security fixesonly security fixes3.11only security fixesonly security fixes3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Bug report
The handling of whitespace around the argument in literal string interpolation (f-string) is unexpected when a conversion specifier (e.g. !r) is applied.
Consider
PEP-498 states:
I suppose that the text above may be technically accurate, but is misleading to common folk:
In the example above,
Noneis enclosed in parentheses(None)but notNone!r.There are no mentions of whitespace in the rest of the PEP.
Formal reproducer:
Your environment