mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-40334: Disallow invalid single statements in the new parser (GH-19774)
After parsing is done in single statement mode, the tokenizer buffer has to be checked for additional lines and a `SyntaxError` must be raised, in case there are any. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
parent
a4dfe8ede5
commit
6d65087655
2 changed files with 51 additions and 1 deletions
|
@ -501,7 +501,6 @@ if 1:
|
|||
self.compile_single("if x:\n f(x)\nelse:\n g(x)")
|
||||
self.compile_single("class T:\n pass")
|
||||
|
||||
@support.skip_if_new_parser('Pegen does not disallow multiline single stmts')
|
||||
def test_bad_single_statement(self):
|
||||
self.assertInvalidSingle('1\n2')
|
||||
self.assertInvalidSingle('def f(): pass')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue