| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
(GH-22395) (GH-23303)
* bpo-39934: backport PR 22395 to 3.9
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-23066)
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>
(cherry picked from commit 02cdfc93f82fecdb7eae97a868d4ee222b9875d9)
Automerge-Triggered-By: GH:lysnikolaou
|
|
|
|
|
|
|
| |
barry_as_flufl rule (GH-23048) (GH-23051)
(cherry picked from commit 06f8c3328dcd81c84d1ee2b3a57b5381dcb38482)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
| |
(cherry picked from commit 15acc4eaba8519d7d5f2acaffde65446b44dcf79)
|
|
|
|
|
| |
assignment rule (GH-20387) (GH-21186)
(cherry picked from commit c8f29ad986f8274fc5fbf889bdd2a211878856b9)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
grammar (GH-21020) (GH-21024)
`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.
(cherry picked from commit 6c4e0bd974f2895d42b63d9d004587e74b286c88)
Automerge-Triggered-By: @pablogsal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-20973)
* bpo-40334: Produce better error messages on invalid targets (GH-20106)
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>
(cherry picked from commit 01ece63d42b830df106948db0aefa6c1ba24416a)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
| |
(GH-20697)
Automerge-Triggered-By: @pablogsal
(cherry picked from commit 9f495908c5bd3645ed1af82d7bae6782720dab77)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
|
|
|
|
|
|
| |
(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.
(cherry picked from commit ae145833025b0156ee2a28219e3370f3b27b2a36)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
|
|
|
|
|
|
|
| |
(GH-20294) (GH-20302)
(cherry picked from commit 72e0aa2)
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
|
|
|
|
| |
parser (GH-20151)
|
|
|
|
|
|
| |
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>
|
|
|
| |
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
| |
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
|
| |
NamedStore has been replaced with Store. The difference between
NamedStore and Store is handled when precess the NamedExpr node
one level upper.
|
|
|
|
|
|
|
| |
(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.
|
| |
|
|
|
|
| |
syntax. (GH-9212)
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Lexically first global and nonlocal syntax errors at given scope should be detected first.
|
|
|
| |
SyntaxError now is raised instead of SyntaxWarning.
|
|
|
|
|
|
|
| |
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).
|
|\
| |
| |
| | |
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
|
| |\
| | |
| | |
| | | |
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
|
| | |
| | |
| | |
| | | |
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
|
|/ / |
|
| |
| |
| |
| | |
Patch by Ivan Levkivskyi.
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| | |
(closes #27514)
Patch by Ammar Askar.
|
|/
|
|
| |
Documentation updates by Martin Panter.
|
|
|
|
| |
robust (closes #25973)
|
|
|
|
| |
Patch by Neil Girdhar.
|
| |
|
|\ |
|
| | |
|
|\ \
| |/ |
|