mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
gh-103656: Transfer f-string buffers to parser to avoid use-after-free (GH-103896)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
This commit is contained in:
parent
76632b836c
commit
9169a56fad
9 changed files with 146 additions and 66 deletions
|
|
@ -1535,5 +1535,19 @@ x = (
|
|||
self.assertAllRaise(SyntaxError, "unterminated triple-quoted f-string literal",
|
||||
['f"""', "f'''"])
|
||||
|
||||
def test_syntax_error_after_debug(self):
|
||||
self.assertAllRaise(SyntaxError, "f-string: expecting a valid expression after '{'",
|
||||
[
|
||||
"f'{1=}{;'",
|
||||
"f'{1=}{+;'",
|
||||
"f'{1=}{2}{;'",
|
||||
"f'{1=}{3}{;'",
|
||||
])
|
||||
self.assertAllRaise(SyntaxError, "f-string: expecting '=', or '!', or ':', or '}'",
|
||||
[
|
||||
"f'{1=}{1;'",
|
||||
"f'{1=}{1;}'",
|
||||
])
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue