Shantanu
9fbc81760e
[3.10] gh-94996: Disallow lambda pos only params with feature_version < (3, 8) (GH-95934) (GH-95938)
(cherry picked from commit a965db37f2
)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Automerge-Triggered-By: GH:lysnikolaou
3 years ago
Shantanu
a92c2d6eb5
[3.10] gh-94996: Disallow parsing pos only params with feature_version < (3, 8) (GH-95935)
(cherry picked from commit b5e3ea2862
)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Automerge-Triggered-By: GH:lysnikolaou
3 years ago
Shantanu
906b345ddd
[3.10] gh-94949: Disallow parsing parenthesised ctx mgr with old feature_version (GH-94950) ( #94990 )
(cherry picked from commit 0daba82221
)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
3 years ago
Shantanu
dda9198021
[3.10] gh-94947: Disallow parsing walrus with feature_version < (3, 8) (GH-94948) ( #94969 )
* 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 ae0be5a53b
)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
3 years ago
wookie184
0ae7284a23
[3.10] gh-94192: Fix error for dictionary literals with invalid expression as value. (GH-94304) ( #94344 )
Co-authored-by: wookie184 <wookie1840@gmail.com>
3 years ago
Pablo Galindo Salgado
05cae26572
[3.10] gh-92858: Improve error message for some suites with syntax error before ':' (GH-92894). ( #94183 )
(cherry picked from commit 2fc83ac3af
)
Co-authored-by: wookie184 <wookie1840@gmail.com>
Co-authored-by: wookie184 <wookie1840@gmail.com>
3 years ago
Pablo Galindo Salgado
8f36c735b2
[3.10] gh-93671: Avoid exponential backtracking in deeply nested sequence patterns in match statements (GH-93680) ( #93690 )
Co-authored-by: Łukasz Langa <lukasz@langa.pl>.
(cherry picked from commit 53a8b17895
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
3 years ago
Matthieu Dartiailh
94609e3192
[3.10] Backport bpo-47212 (GH-32302) to Python 3.10 (GH-32334)
(cherry picked from commit aa0f056a00
)
# Conflicts:
# Grammar/python.gram
# Parser/action_helpers.c
Automerge-Triggered-By: GH:pablogsal
4 years ago
Pablo Galindo Salgado
14284b0e71
[3.10] Allow the parser to avoid nested processing of invalid rules (GH-31252). (GH-31257)
(cherry picked from commit 390459de6d
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Pablo Galindo Salgado
9b23f8f78f
[3.10] bpo-46707: Avoid potential exponential backtracking in some syntax errors (GH-31241). (GH-31242)
(cherry picked from commit b71dc71905
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Pablo Galindo Salgado
c72311d917
[3.10] bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses. (GH-29767)
Backport of GH-29757
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
4 years ago
Pablo Galindo Salgado
511ee1c0fa
[3.10] bpo-45727: Make the syntax error for missing comma more consistent (GH-29427) (GH-29647)
(cherry picked from commit 546cefcda7
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Pablo Galindo Salgado
5618c81e13
[3.10] bpo-45716: Improve the error message when using True/False/None as keywords in a call (GH-29413). (GH-29428)
(cherry picked from commit e2d65630f3
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Pablo Galindo Salgado
0e34a5918c
[3.10] bpo-44257: fix "assigment_expr" typo + regenerate the grammar, and remove unused imports (GH-29393) (GH-29395)
Co-authored-by: Wim Glenn <wglenn@jumptrading.com>.
(cherry picked from commit 762173c670
)
Co-authored-by: wim glenn <wim.glenn@gmail.com>
4 years ago
Miss Islington (bot)
3397e3192c
bpo-43914: Correctly highlight SyntaxError exceptions for invalid generator expression in function calls (GH-28576)
(cherry picked from commit e5f13ce5b4
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Miss Islington (bot)
9e209d48ca
bpo-43914: Correctly highlight SyntaxError exceptions for invalid generator expression in function calls (GH-28576)
(cherry picked from commit e5f13ce5b4
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Miss Islington (bot)
846a10fc45
bpo-44947: Refine the syntax error for trailing commas in import statements (GH-27814)
(cherry picked from commit b2f68b1900
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Pablo Galindo Salgado
b1bd16c252
[3.10] bpo-44838: Refine the custom syntax errors for invalid 'if' expressions (GH-27615). (GH-27616)
…
(cherry picked from commit f5cbea6b1b
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Automerge-Triggered-By: GH:lysnikolaou
4 years ago
Miss Islington (bot)
567176249e
bpo-44792: Improve syntax errors for if expressions (GH-27506) (GH-27565)
(cherry picked from commit 28b6dc9dd5
)
Co-authored-by: Miguel Brito <5544985+miguendes@users.noreply.github.com>
4 years ago
Miss Islington (bot)
35035bc35a
bpo-34013: Don't consider a grouped expression when reporting legacy print syntax errors (GH-27521)
(cherry picked from commit 208a7e957b
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Miss Islington (bot)
68e3dca068
bpo-34013: Move the Python 2 hints from the exception constructor to the parser (GH-27392)
(cherry picked from commit ecc3c8e421
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Pablo Galindo Salgado
b977f8510e
[3.10] bpo-34013: Generalize the invalid legacy statement error message (GH-27389). (GH-27391)
(cherry picked from commit 6948964ecf
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
4 years ago
Miss Islington (bot)
11f1a30cdb
bpo-44456: Improve the syntax error when mixing keyword and positional patterns (GH-26793)
(cherry picked from commit 0acc258fe6
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
4 years ago
Pablo Galindo
a8c418d5ed
[3.10] bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632) (GH-26792)
(cherry picked from commit 05073036dc
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
4 years ago
Miss Islington (bot)
3e137426de
bpo-44385: Remove unused grammar rules (GH-26655)
Automerge-Triggered-By: GH:lysnikolaou
(cherry picked from commit e7b4644607
)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
4 years ago
Pablo Galindo
e53f72a1b4
[3.10] bpo-44305: Improve syntax error for try blocks without except or finally (GH-26523) (GH-26524)
(cherry picked from commit b250f89bb7
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
4 years ago
Miss Islington (bot)
ae1732d461
bpo-44180: Fix edge cases in invalid assigment rules in the parser (GH-26283)
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.
(cherry picked from commit c878a97968
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
4 years ago
Miss Islington (bot)
ec0699c044
bpo-44168: Fix error message in the parser for keyword arguments for invalid expressions (GH-26210) (GH-26247)
(cherry picked from commit 33c0c90dea
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
4 years ago
Miss Islington (bot)
9a0e65c8e0
bpo-43149: Correct the syntax error message for multiple exception types (GH-25996) GH-25997)
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit 6692dc1ca9
)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
4 years ago
Brandt Bucher
dbe60ee09d
bpo-43892: Validate the first term of complex literal value patterns (GH-25735)
5 years ago
Nick Coghlan
1e7b858575
bpo-43892: Make match patterns explicit in the AST (GH-25585)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
5 years ago
Pablo Galindo
a77aac4fca
bpo-43914: Highlight invalid ranges in SyntaxErrors ( #25525 )
To improve the user experience understanding what part of the error messages associated with SyntaxErrors is wrong, we can highlight the whole error range and not only place the caret at the first character. In this way:
>>> foo(x, z for z in range(10), t, w)
File "<stdin>", line 1
foo(x, z for z in range(10), t, w)
^
SyntaxError: Generator expression must be parenthesized
becomes
>>> foo(x, z for z in range(10), t, w)
File "<stdin>", line 1
foo(x, z for z in range(10), t, w)
^^^^^^^^^^^^^^^^^^^^
SyntaxError: Generator expression must be parenthesized
5 years ago
Pablo Galindo
56c95dfe27
bpo-43859: Improve the error message for IndentationError exceptions (GH-25431)
5 years ago
Pablo Galindo
b5b98bd8f8
bpo-43823: Fix location of one of the errors for invalid dictionary literals (GH-25427)
5 years ago
Pablo Galindo
b280248be8
bpo-43822: Improve syntax errors for missing commas (GH-25377)
5 years ago
Pablo Galindo
da74350174
bpo-43823: Improve syntax errors for invalid dictionary literals (GH-25378)
5 years ago
Pablo Galindo
30ed93bfec
bpo-43797: Handle correctly invalid assignments inside function calls and generators (GH-25390)
5 years ago
Pablo Galindo
d9151cb453
Ensure that early = are not matched by the parser as invalid comparisons (GH-25375)
5 years ago
Pablo Galindo
b86ed8e3bb
bpo-43797: Improve syntax error for invalid comparisons ( #25317 )
* 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>
5 years ago
Matthew Suozzo
75a06f067b
bpo-43798: Add source location attributes to alias (GH-25324)
* Add source location attributes to alias.
* Move alias star construction to pegen helper.
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
5 years ago
Victor Stinner
d27f8d2e07
bpo-43244: Rename pycore_ast.h functions to _PyAST_xxx() (GH-25252)
Rename AST functions of pycore_ast.h to use the "_PyAST_" prefix.
Remove macros creating aliases without prefix. For example, Module()
becomes _PyAST_Module(). Update Grammar/python.gram to use
_PyAST_xxx() functions.
5 years ago
Pablo Galindo
8efad61963
bpo-41064: Improve syntax error for invalid usage of '**' in f-strings (GH-25006)
5 years ago
Pablo Galindo
08fb8ac99a
bpo-42128: Add 'missing :' syntax error message to match statements (GH-24733)
5 years ago
Brandt Bucher
145bf269df
bpo-42128: Structural Pattern Matching (PEP 634) (GH-22917)
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Talin <viridia@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
5 years ago
Pablo Galindo
206cbdab16
bpo-43149: Improve error message for exception group without parentheses (GH-24467)
5 years ago
Pablo Galindo
d4e6ed7e5f
bpo-43121: Fix incorrect SyntaxError message for missing comma (GH-24436)
5 years ago
Pablo Galindo
58fb156edd
bpo-42997: Improve error message for missing : before suites (GH-24292)
* 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.
5 years ago
Pablo Galindo
835f14ff8e
bpo-43017: Improve error message for unparenthesised tuples in comprehensions (GH24314)
5 years ago
Lysandros Nikolaou
07dcd86cee
bpo-42860: Remove type error from grammar (GH-24156)
This is only there so that alternative implementations written in statically-typed languages can use this grammar without
having type errors in the way.
Automerge-Triggered-By: GH:lysnikolaou
5 years ago
Lysandros Nikolaou
2ea320dddd
bpo-40631: Disallow single parenthesized star target (GH-24027)
5 years ago