mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:56 +00:00
Disallow newlines in format specifiers of single quoted f- or t-strings (#18708)
This commit is contained in:
parent
23261a38a0
commit
1188ffccc4
17 changed files with 521 additions and 513 deletions
|
@ -169,15 +169,7 @@ Module(
|
|||
InterpolatedStringFormatSpec {
|
||||
range: 226..228,
|
||||
node_index: AtomicNodeIndex(..),
|
||||
elements: [
|
||||
Literal(
|
||||
InterpolatedStringLiteralElement {
|
||||
range: 226..228,
|
||||
node_index: AtomicNodeIndex(..),
|
||||
value: "\\",
|
||||
},
|
||||
),
|
||||
],
|
||||
elements: [],
|
||||
},
|
||||
),
|
||||
},
|
||||
|
@ -385,11 +377,22 @@ Module(
|
|||
6 | 'format spec'}
|
||||
7 |
|
||||
8 | f'middle {'string':\\
|
||||
| ^ Syntax Error: f-string: unterminated string
|
||||
| ^^ Syntax Error: f-string: newlines are not allowed in format specifiers when using single quotes
|
||||
9 | 'format spec'}
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
6 | 'format spec'}
|
||||
7 |
|
||||
8 | f'middle {'string':\\
|
||||
| ^ Syntax Error: f-string: expecting '}'
|
||||
9 | 'format spec'}
|
||||
10 |
|
||||
11 | f'middle {'string':\\\
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
8 | f'middle {'string':\\
|
||||
9 | 'format spec'}
|
||||
|
|
|
@ -384,7 +384,7 @@ Module(
|
|||
3 | f"hello {x
|
||||
4 | 2 + 2
|
||||
5 | f"hello {x:
|
||||
| ^ Syntax Error: f-string: unterminated string
|
||||
| ^ Syntax Error: f-string: newlines are not allowed in format specifiers when using single quotes
|
||||
6 | 3 + 3
|
||||
7 | f"hello {x}
|
||||
|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue