summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_peg_parser.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40958: Avoid buffer overflow in the parser when indexing the current ↵Miss Islington (bot)2020-06-161-3/+3
| | | | | | | line (GH-20875) (GH-20919) (cherry picked from commit 51c5896b6205911d29ac07f167ec7f3cf1cb600d) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-40847: Consider a line with only a LINECONT a blank line (GH-20769)Miss Islington (bot)2020-06-111-0/+7
| | | | | | | | | | | | | A line with only a line continuation character should be considered a blank line at tokenizer level so that only a single NEWLINE token gets emitted. The old parser was working around the issue, but the new parser threw a `SyntaxError` for valid input. For example, an empty line following a line continuation character was interpreted as a `SyntaxError`. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> (cherry picked from commit 896f4cf63f9ab93e30572d879a5719d5aa2499fb) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40661: Fix segfault when parsing invalid input (GH-20165)Lysandros Nikolaou2020-05-181-0/+1
| | | | | | Fix segfaults when parsing very complex invalid input, like `import äˆ ð£„¯ð¢·žð±‹á”€ð””ð‘©±å®ä±¬ð©¾\nð—¶½`. Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* bpo-40334: Correctly identify invalid target in assignment errors (GH-20076)Pablo Galindo2020-05-151-1/+1
| | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40618: Disallow invalid targets in augassign and except clauses (GH-20083)Lysandros Nikolaou2020-05-141-0/+25
| | | | | | | | | This commit fixes the new parser to disallow invalid targets in the following scenarios: - Augmented assignments must only accept a single target (Name, Attribute or Subscript), but no tuples or lists. - `except` clauses should only accept a single `Name` as a target. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-40334: Error message for invalid default args in function call (GH-19973)Lysandros Nikolaou2020-05-071-0/+3
| | | | | When parsing something like `f(g()=2)`, where the name of a default arg is not a NAME, but an arbitrary expression, a specialised error message is emitted.
* bpo-40334: Spacialized error message for invalid args after bare '*' (GH-19865)Lysandros Nikolaou2020-05-041-0/+6
| | | When parsing things like `def f(*): pass` the old parser used to output `SyntaxError: named arguments must follow bare *`, which the new parser wasn't able to do.
* bpo-40443: Remove unused imports in tests (GH-19805)Victor Stinner2020-04-291-3/+0
|
* bpo-40334: Fix test_peg_parser to actually use the old parser (GH-19778)Lysandros Nikolaou2020-04-291-5/+4
| | | Now that the default parser is the new PEG parser, ast.parse uses it, which means that we don't actually test something in test_peg_parser. This commit introduces a new keyword argument (`oldparser`) for `_peg_parser.parse_string` for specifying that a string needs to be parsed with the old parser. This keyword argument is used in the tests to actually compare the ASTs the new parser generates with those generated by the old parser.
* bpo-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)Victor Stinner2020-04-231-1/+2
| | | | | | | | | | | * Rename PyConfig.use_peg to _use_peg_parser * Document PyConfig._use_peg_parser and mark it a deprecated * Mark -X oldparser option and PYTHONOLDPARSER env var as deprecated in the documentation. * Add use_old_parser() and skip_if_new_parser() to test.support * Remove sys.flags.use_peg: use_old_parser() uses _testinternalcapi.get_configs() instead. * Enhance test_embed tests * subprocess._args_from_interpreter_flags() copies -X oldparser
* bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)Pablo Galindo2020-04-221-0/+764
Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>