mirror of https://github.com/astral-sh/ruff
## Summary
This PR fixes a bug in the lexer for f-string format spec where it would
consider the `{{` (double curly braces) as an escape pattern.
This is not the case as evident by the
[PEP](https://peps.python.org/pep-0701/#how-to-produce-these-new-tokens)
as well but I missed the part:
> [..]
> * **If in “format specifier mode” (see step 3), an opening brace ({)
or a closing brace (}).**
> * If not in “format specifier mode” (see step 3), an opening brace ({)
or a closing brace (}) that is not immediately followed by another
opening/closing brace.
## Test Plan
Add a test case to verify the fix and update the snapshot.
fixes: #7778
|
||
|---|---|---|
| .. | ||
| lexer | ||
| snapshots | ||
| context.rs | ||
| function.rs | ||
| lexer.rs | ||
| lib.rs | ||
| parser.rs | ||
| python.lalrpop | ||
| python.rs | ||
| soft_keywords.rs | ||
| string.rs | ||
| token.rs | ||
| typing.rs | ||