diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-01-31 22:48:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-31 22:48:23 (GMT) |
commit | 40901518167c66abc1ebc5b71c5b86d733cfa154 (patch) | |
tree | 138c2482c5b1e1c91bb705d4dac941260aeb35d4 /Lib/test | |
parent | a1e9a1e120a11c563e166c15721169184c802f8b (diff) | |
download | cpython-40901518167c66abc1ebc5b71c5b86d733cfa154.zip cpython-40901518167c66abc1ebc5b71c5b86d733cfa154.tar.gz cpython-40901518167c66abc1ebc5b71c5b86d733cfa154.tar.bz2 |
bpo-42986: Fix parser crash when reporting syntax errors in f-string with newlines (GH-24279)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_fstring.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py index 7ca1512..d7143d1 100644 --- a/Lib/test/test_fstring.py +++ b/Lib/test/test_fstring.py @@ -664,6 +664,9 @@ x = ( self.assertAllRaise(SyntaxError, 'unterminated string literal', ["f'{\n}'", ]) + def test_newlines_before_syntax_error(self): + self.assertAllRaise(SyntaxError, "invalid syntax", + ["f'{.}'", "\nf'{.}'", "\n\nf'{.}'"]) def test_backslashes_in_string_part(self): self.assertEqual(f'\t', '\t') |