aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_syntax.py
Commit message (Collapse)AuthorAge
...
* Ensure that early = are not matched by the parser as invalid comparisons ↵Pablo Galindo2021-04-13
| | | | (GH-25375)
* bpo-43797: Improve syntax error for invalid comparisons (#25317)Pablo Galindo2021-04-12
| | | | | | | | | | | | | * bpo-43797: Improve syntax error for invalid comparisons * Update Lib/test/test_fstring.py Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> * Apply review comments * can't -> cannot Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
* bpo-43555: Report the column offset for invalid line continuation character ↵Pablo Galindo2021-03-22
| | | | (GH-24939)
* bpo-42128: Add 'missing :' syntax error message to match statements (GH-24733)Pablo Galindo2021-03-18
|
* bpo-43149: Improve error message for exception group without parentheses ↵Pablo Galindo2021-02-07
| | | | (GH-24467)
* bpo-43121: Fix incorrect SyntaxError message for missing comma (GH-24436)Pablo Galindo2021-02-03
|
* bpo-42997: Improve error message for missing : before suites (GH-24292)Pablo Galindo2021-02-02
| | | | | | | | * Add to the peg generator a new directive ('&&') that allows to expect a token and hard fail the parsing if the token is not found. This allows to quickly emmit syntax errors for missing tokens. * Use the new grammar element to hard-fail if the ':' is missing before suites.
* bpo-43017: Improve error message for unparenthesised tuples in ↵Pablo Galindo2021-01-31
| | | | comprehensions (GH24314)
* bpo-42864: Improve error messages regarding unclosed parentheses (GH-24161)Pablo Galindo2021-01-19
|
* bpo-30858: Improve error location for expressions with assignments (GH-23753)Pablo Galindo2020-12-13
| | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-42218: Correctly handle errors in left-recursive rules (GH-23065)Lysandros Nikolaou2020-10-31
| | | | | | | Left-recursive rules need to check for errors explicitly, since even if the rule returns NULL, the parsing might continue and lead to long-distance failures. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-42214: Fix check for NOTEQUAL token in the PEG parser for the ↵Pablo Galindo2020-10-30
| | | | barry_as_flufl rule (GH-23048)
* bpo-41659: Disallow curly brace directly after primary (GH-22996)Lysandros Nikolaou2020-10-27
|
* bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)Batuhan Taskaya2020-10-06
| | | | | The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions. For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
* bpo-39934: Account for control blocks in 'except' in compiler. (GH-22395)Mark Shannon2020-09-25
| | | * Account for control blocks in 'except' in compiler. Fixes #39934.
* bpo-40769: Allow extra surrounding parentheses for invalid annotated ↵Batuhan Taskaya2020-06-27
| | | | assignment rule (GH-20387)
* bpo-41060: Avoid SEGFAULT when calling GET_INVALID_TARGET in the grammar ↵Lysandros Nikolaou2020-06-21
| | | | | | | | | (GH-21020) `GET_INVALID_TARGET` might unexpectedly return `NULL`, which if not caught will cause a SEGFAULT. Therefore, this commit introduces a new inline function `RAISE_SYNTAX_ERROR_INVALID_TARGET` that always checks for `GET_INVALID_TARGET` returning NULL and can be used in the grammar, replacing the long C ternary operation used till now.
* bpo-40334: Produce better error messages on invalid targets (GH-20106)Lysandros Nikolaou2020-06-19
| | | | | | | | | | | | | | The following error messages get produced: - `cannot delete ...` for invalid `del` targets - `... is an illegal 'for' target` for invalid targets in for statements - `... is an illegal 'with' target` for invalid targets in with statements Additionally, a few `cut`s were added in various places before the invocation of the `invalid_*` rule, in order to speed things up. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-40939: Remove the old parser (GH-20768)Pablo Galindo2020-06-11
| | | This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.
* bpo-40847: Consider a line with only a LINECONT a blank line (GH-20769)Lysandros Nikolaou2020-06-11
| | | | | | | | | | 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>
* bpo-40903: Handle multiple '=' in invalid assignment rules in the PEG parser ↵Pablo Galindo2020-06-07
| | | | | (GH-20697) Automerge-Triggered-By: @pablogsal
* bpo-40334: Produce better error messages for non-parenthesized genexps ↵Lysandros Nikolaou2020-05-22
| | | | | | (GH-20153) The error message, generated for a non-parenthesized generator expression in function calls, was still the generic `invalid syntax`, when the generator expression wasn't appearing as the first argument in the call. With this patch, even on input like `f(a, b, c for c in d, e)`, the correct error message gets produced.
* bpo-40176: Improve error messages for trailing comma on from import (GH-20294)Batuhan Taskaya2020-05-21
|
* bpo-40334: Reproduce error message for type comments on bare '*' in the new ↵Lysandros Nikolaou2020-05-18
| | | | parser (GH-20151)
* bpo-40661: Fix segfault when parsing invalid input (GH-20165)Lysandros Nikolaou2020-05-18
| | | | | | 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-15
| | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40618: Disallow invalid targets in augassign and except clauses (GH-20083)Lysandros Nikolaou2020-05-14
| | | | | | | | | 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: produce specialized errors for invalid del targets (GH-19911)Shantanu2020-05-11
|
* bpo-40334: Spacialized error message for invalid args after bare '*' (GH-19865)Lysandros Nikolaou2020-05-04
| | | 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-30
|
* bpo-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)Victor Stinner2020-04-23
| | | | | | | | | | | * 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-22
| | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40147: Move the check for duplicate keywords to the compiler (GH-19289)Pablo Galindo2020-04-03
|
* bpo-39176: Improve error message for 'named assignment' (GH-17777)Ned Batchelder2019-12-31
|
* bpo-37500: Make sure dead code does not generate bytecode but also detect ↵Pablo Galindo2019-07-15
| | | | | | | | | | | | syntax errors (GH-14612) https://bugs.python.org/issue37500 Add a new field to the compiler structure that allows to be configured so no bytecode is emitted. In this way is possible to detect errors by walking the nodes while preserving optimizations. https://bugs.python.org/issue37500
* bpo-1875: Raise SyntaxError in invalid blocks that will be optimised away ↵Pablo Galindo2019-05-17
| | | | | | | (GH-13332) Move the check for dead conditionals (if 0) to the peephole optimizer and make sure that the code block is still compiled to report any existing syntax errors within.
* bpo-36187: Remove NamedStore. (GH-12167)Serhiy Storchaka2019-03-05
| | | | | NamedStore has been replaced with Store. The difference between NamedStore and Store is handled when precess the NamedExpr node one level upper.
* bpo-36052: Raise a SyntaxError when assigning a value to __debug__ with := ↵Stéphane Wirtel2019-02-21
| | | | | | | (GH-11958) Trying to assign a value to __debug__ using the assignment operator is supposed to fail, but a missing check for forbidden names when setting the context in the ast was preventing this behaviour.
* bpo-35169: Improve error messages for forbidden assignments. (GH-10342)Serhiy Storchaka2018-11-20
|
* closes bpo-34641: Further restrict the LHS of keyword argument function call ↵Benjamin Peterson2018-09-12
| | | | syntax. (GH-9212)
* bpo-32489: Allow 'continue' in 'finally' clause. (GH-5822)Serhiy Storchaka2018-03-18
|
* bpo-32482: Fix suspicious code in tests for syntax and grammar. (#5086)Serhiy Storchaka2018-01-04
|
* bpo-32023: Disallow genexprs without parenthesis in class definitions. (#4400)Serhiy Storchaka2017-11-15
|
* bpo-32012: Disallow trailing comma after genexpr without parenthesis. (#4382)Serhiy Storchaka2017-11-15
|
* bpo-28936: Detect lexically first syntax error first (#4097)Ivan Levkivskyi2017-10-27
| | | | Lexically first global and nonlocal syntax errors at given scope should be detected first.
* bpo-31847: Fix commented out tests in test_syntax. (#4084)Serhiy Storchaka2017-10-24
| | | SyntaxError now is raised instead of SyntaxWarning.
* Issue #26110: Add LOAD_METHOD/CALL_METHOD opcodes.Yury Selivanov2016-12-13
| | | | | | | Special thanks to INADA Naoki for pushing the patch through the last mile, Serhiy Storchaka for reviewing the code, and to Victor Stinner for suggesting the idea (originally implemented in the PyPy project).
* Issue #28512: Fixed setting the offset attribute of SyntaxError bySerhiy Storchaka2016-12-11
|\ | | | | | | PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
| * Issue #28512: Fixed setting the offset attribute of SyntaxError bySerhiy Storchaka2016-12-11
| |\ | | | | | | | | | PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
| | * Issue #28512: Fixed setting the offset attribute of SyntaxError bySerhiy Storchaka2016-12-11
| | | | | | | | | | | | PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().