aboutsummaryrefslogtreecommitdiff
path: root/Parser/parser.c
AgeCommit message (Collapse)Author
2023-03-06[3.11] gh-102416: Do not memoize incorrectly loop rules in the parser ↵Pablo Galindo Salgado
(GH-102467). (#102473)
2023-01-16[3.11] gh-101046: Fix a potential memory leak in the parser when raising ↵Pablo Galindo Salgado
MemoryError (GH-101051) (#101085) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-11-20[3.11] gh-99211: Point to except/except* on syntax errors when mixing them ↵Lysandros Nikolaou
(GH-99215) (GH-99622) gh-99211: Point to except/except* on syntax errors when mixing them (GH-99215) (cherry picked from commit 9c4232ae8972a33f84e875cfdd866318a1233e47)
2022-11-07[3.11] gh-99153: set location on SyntaxError for try with both except and ↵Irit Katriel
except* (GH-99160) (#99168)
2022-10-05[3.11] gh-96587: Raise `SyntaxError` for PEP654 on older `feature_version` ↵Nikita Sobolev
(GH-96588) (#96591) (cherry picked from commit 2c7d2e8d46164efb6e27a64081d8e949f6876515) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-08-12[3.11] gh-94996: Disallow lambda pos only params with feature_version < (3, ↵Shantanu
8) (GH-95934) (GH-95936) (cherry picked from commit a965db37f27ffb232312bc13d9a509f0d93fcd20) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Automerge-Triggered-By: GH:lysnikolaou
2022-08-12gh-94996: Disallow parsing pos only params with feature_version < (3, 8) ↵Miss Islington (bot)
(GH-94997) (cherry picked from commit b5e3ea286289fcad12be78480daf3756e350f69f) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-07-18gh-94949: Disallow parsing parenthesised ctx mgr with old feature_version ↵Miss Islington (bot)
(GH-94950) * gh-94949: Disallow parsing parenthesised ctx manager with old feature_version * 📜🤖 Added by blurb_it. * Allow it with feature_version=(3, 9) as well Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit 0daba822212cd5d6c63384a27f390f0945330c2b) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-07-18gh-94947: Disallow parsing walrus with feature_version < (3, 8) (GH-94948)Miss Islington (bot)
* gh-94947: Disallow parsing walrus with feature_version < (3, 8) * oops, commit the parser * 📜🤖 Added by blurb_it. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit ae0be5a53bb4caee3de4888341addd9c94133f2d) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-06-26gh-94192: Fix error for dictionary literals with invalid expression as ↵Miss Islington (bot)
value. (GH-94304) * Fix error for dictionary literals with invalid expression as value. * Remove trailing whitespace (cherry picked from commit 8c237a7a71d52f996f58dc58f6b6ce558d209494) Co-authored-by: wookie184 <wookie1840@gmail.com>
2022-06-23[3.11] gh-92858: Improve error message for some suites with syntax error ↵Pablo Galindo Salgado
before ':' (GH-92894) (#94180) (cherry picked from commit 2fc83ac3afa161578200dbf8d823a20e0801c0c0) Co-authored-by: wookie184 <wookie1840@gmail.com> Co-authored-by: wookie184 <wookie1840@gmail.com>
2022-06-10gh-93671: Avoid exponential backtracking in deeply nested sequence patterns ↵Miss Islington (bot)
in match statements (GH-93680) Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 53a8b17895e91d08f76a2fb59a555d012cd85ab4) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-05-19gh-90473: Decrease recursion limit and skip tests on WASI (GH-92803)Miss Islington (bot)
(cherry picked from commit 137fd3d88aa46669f5717734e823f4c594ab2843) Co-authored-by: Christian Heimes <christian@python.org>
2022-04-05bpo-47212: Improve error messages for un-parenthesized generator expressions ↵Matthieu Dartiailh
(GH-32302)
2022-03-26bpo-43224: Implement PEP 646 grammar changes (GH-31018)Matthew Rahtz
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-22bpo-46838: Syntax error improvements for function definitions (GH-31590)Pablo Galindo Salgado
2022-02-10Allow the parser to avoid nested processing of invalid rules (GH-31252)Pablo Galindo Salgado
2022-02-10bpo-46707: Avoid potential exponential backtracking in some syntax errors ↵Pablo Galindo Salgado
(GH-31241)
2022-01-03bpo-46110: Restore commit e9898bf153d26059261ffef11f7643ae991e2a4cPablo Galindo Salgado
This restores commit e9898bf153d26059261ffef11f7643ae991e2a4c .
2022-01-03Revert "bpo-46110: Add a recursion check to avoid stack overflow in the PEG ↵Pablo Galindo Salgado
parser (GH-30177)" (GH-30363) This reverts commit e9898bf153d26059261ffef11f7643ae991e2a4c temporarily as we want to confirm if this commit is the cause of a slowdown at startup time.
2021-12-20bpo-46110: Add a recursion check to avoid stack overflow in the PEG parser ↵Pablo Galindo Salgado
(GH-30177) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2021-12-14bpo-45292: [PEP-654] add except* (GH-29581)Irit Katriel
2021-11-26bpo-45866: pegen strips directory of "generated from" header (GH-29777)Victor Stinner
"make regen-all" now produces the same output when run from a directory other than the source tree: when building Python out of the source tree.
2021-11-24bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if ↵Pablo Galindo Salgado
inside parentheses (GH-29757)
2021-11-20bpo-45450: Improve syntax error for parenthesized arguments (GH-28906)Pablo Galindo Salgado
2021-11-19bpo-45727: Make the syntax error for missing comma more consistent (GH-29427)Pablo Galindo Salgado
2021-11-09bpo-45764: improve error message when missing '(' after 'def' (GH-29484)Carl Friedrich Bolz-Tereick
to achieve this, change the grammar to expect the '(' token after 'def' NAME. Automerge-Triggered-By: GH:pablogsal
2021-11-05bpo-45716: Improve the error message when using True/False/None as keywords ↵Pablo Galindo Salgado
in a call (GH-29413)
2021-11-03bpo-44257: fix "assigment_expr" typo + regenerate the grammar, and remove ↵wim glenn
unused imports (GH-29393) Co-authored-by: Wim Glenn <wglenn@jumptrading.com>
2021-10-19bpo-45494: Fix parser crash when reporting errors involving invalid ↵Pablo Galindo Salgado
continuation characters (GH-28993) There are two errors that this commit fixes: * The parser was not correctly computing the offset and the string source for E_LINECONT errors due to the incorrect usage of strtok(). * The parser was not correctly unwinding the call stack when a tokenizer exception happened in rules involving optionals ('?', [...]) as we always make them return valid results by using the comma operator. We need to check first if we don't have an error before continuing.
2021-09-27bpo-43914: Correctly highlight SyntaxError exceptions for invalid generator ↵Pablo Galindo Salgado
expression in function calls (GH-28576)
2021-09-05Extract visitors from the grammar nodes and call makers in the peg generator ↵Pablo Galindo Salgado
(GH-28172) Simplify the peg generator logic by extracting as much visitors as possible to disentangle the flow and separate concerns.
2021-08-18bpo-44947: Refine the syntax error for trailing commas in import statements ↵Pablo Galindo Salgado
(GH-27814)
2021-08-12Update pegen to use the latest upstream developments (GH-27586)Pablo Galindo Salgado
2021-08-05bpo-44838: Refine the custom syntax errors for invalid 'if' expressions ↵Pablo Galindo Salgado
(GH-27615)
2021-08-02bpo-44792: Improve syntax errors for if expressions (GH-27506)Miguel Brito
2021-08-01bpo-34013: Don't consider a grouped expression when reporting legacy print ↵Pablo Galindo Salgado
syntax errors (GH-27521)
2021-07-31Divide the grammar into sections to improve readability (GH-27502)Pablo Galindo Salgado
2021-07-27bpo-34013: Move the Python 2 hints from the exception constructor to the ↵Pablo Galindo Salgado
parser (GH-27392)
2021-07-27bpo-34013: Generalize the invalid legacy statement error message (GH-27389)Pablo Galindo Salgado
2021-07-16Remove unnecessary 'invalid_primary' rule in the parser (GH-27186)Pablo Galindo Salgado
2021-06-24bpo-44456: Improve the syntax error when mixing keyword and positional ↵Pablo Galindo
patterns (GH-26793)
2021-06-10bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632)Pablo Galindo
2021-06-10bpo-44385: Remove unused grammar rules (GH-26655)Lysandros Nikolaou
Automerge-Triggered-By: GH:lysnikolaou
2021-06-09bpo-44345: Fix 'generated by' comment in parser.c (GH-26615)Akira Nonaka
2021-06-03bpo-44305: Improve syntax error for try blocks without except or finally ↵Pablo Galindo
(GH-26523)
2021-05-21bpo-44180: Fix edge cases in invalid assigment rules in the parser (GH-26283)Pablo Galindo
The invalid assignment rules are very delicate since the parser can easily raise an invalid assignment when a keyword argument is provided. As they are very deep into the grammar tree, is very difficult to specify in which contexts these rules can be used and in which don't. For that, we need to use a different version of the rule that doesn't do error checking in those situations where we don't want the rule to raise (keyword arguments and generator expressions). We also need to check if we are in left-recursive rule, as those can try to eagerly advance the parser even if the parse will fail at the end of the expression. Failing to do this allows the parser to start parsing a call as a tuple and incorrectly identify a keyword argument as an invalid assignment, before it realizes that it was not a tuple after all.
2021-05-19bpo-44168: Fix error message in the parser for keyword arguments for invalid ↵Pablo Galindo
expressions (GH-26210)
2021-05-08bpo-43149: Correct the syntax error message for multiple exception types ↵Pablo Galindo
(GH-25996) Automerge-Triggered-By: GH:pablogsal
2021-04-29bpo-43892: Validate the first term of complex literal value patterns (GH-25735)Brandt Bucher