sobolevn
84914ad0e5
gh-133999: Fix `except` parsing regression in 3.14 ( #134035 )
2025-05-17 17:57:02 +03:00
Rafael Fontenelle
6df39765e6
Remove trailing whitespace from python.gram ( #133858 )
...
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-05-14 10:52:19 +03:00
Stan Ulbrych
dbca27cfca
gh-133379: Fix misuse of the term "arguments" in error messages (GH-133382)
...
The right term is "parameters".
2025-05-10 15:00:43 +03:00
sobolevn
ca0a96dfaa
gh-133194: Fix regression with PEP 758 parsing on older `feature_version` ( #133289 )
...
gh-133192: Fix regression with PEP 758 parsing on older `feature_version`
2025-05-03 10:33:14 +03:00
sobolevn
a6ddd078d0
gh-123539: Improve SyntaxError msg for `import as` with not a name ( #123629 )
2025-05-02 08:34:13 +00:00
sobolevn
5cdd49b3f4
gh-133196: Guard PEP 750 grammar with `CHECK_VERSION` ( #133225 )
2025-05-01 09:17:07 +02:00
sobolevn
b1f893875b
gh-133194: Add `CHECK_VERSION` to new PEP758 grammar ( #133195 )
2025-04-30 13:39:26 +03:00
Lysandros Nikolaou
60202609a2
gh-132661: Implement PEP 750 ( #132662 )
...
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Wingy <git@wingysam.xyz>
Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Paul Everitt <pauleveritt@me.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-30 11:46:41 +02:00
Rafael Fontenelle
fd0f5d0a5e
Remove trailing whitespace from python.gram ( #133175 )
2025-04-30 10:35:15 +02:00
Steele Farnsworth
99b71efe8e
gh-129858: Special syntax error for `elif` block after `else` ( #129902 )
2025-04-25 01:25:48 +00:00
Pablo Galindo Salgado
bf3a0a1c0f
gh-132449: Improve syntax error messages for keywords with typos ( #132450 )
...
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-04-22 11:01:55 +02:00
Pablo Galindo Salgado
c2ac662f28
gh-131831: Implement PEP 758 – Allow except and except* expressions without parentheses ( #131833 )
2025-04-01 19:04:56 +00:00
Sergey Miryanov
bcc9a5dddb
gh-129515: Clarify syntax error messages for conditional expressions ( #129880 )
...
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-02-18 21:43:19 +00:00
Pablo Galindo Salgado
3bd3e09588
gh-125331: Allow the parser to activate future imports on the fly ( #125482 )
2025-02-14 04:54:56 +00:00
Pablo Galindo Salgado
6fb5138776
gh-88535: Improve syntax error for wrongly closed strings ( #26633 )
2025-02-13 01:30:20 +00:00
Rigel Di Scala
39c859f6ff
gh-122951: Simplify the grammar of the assignment rule ( #124998 )
2024-10-06 11:55:56 +02:00
sobolevn
23f159ae71
gh-123562: Improve `SyntaxError` message for `case ... as a.b` ( #123563 )
2024-09-02 13:11:44 +02:00
sobolevn
e451a8937d
gh-123440: Improve error message for `except as` used with not a name ( #123442 )
2024-08-30 17:21:59 +01:00
Petr Viktorin
31a4fb3c74
gh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else' statements ( #29513 )" ( #119974 )
...
This reverts commit 1c8f912ebd
.
2024-06-03 18:10:15 -07:00
Petr Viktorin
48f21b3631
gh-118235: Move RAISE_SYNTAX_ERROR actions to invalid rules and make sure they stay there (GH-119731)
...
The Full Grammar specification in the docs omits rule actions, so grammar rules that raise a syntax error looked like valid syntax.
This was solved in ef940de
by hiding those rules in the custom syntax highlighter.
This moves all syntax-error alternatives to invalid rules, adds a validator that ensures that actions containing RAISE_SYNTAX_ERROR are in invalid rules, and reverts the syntax highlighter hack.
2024-05-30 09:27:32 +02:00
Nikita Sobolev
b60d4c0d53
gh-118090: Improve error message for empty type param brackets (GH-118091)
2024-05-07 14:01:06 +02:00
Jelle Zijlstra
ca269e58c2
gh-116126: Implement PEP 696 ( #116129 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-05-03 06:17:32 -07:00
Nikita Sobolev
51aefc5bf9
gh-118323: Document `&&` grammar syntax ( #118324 )
2024-04-27 11:36:06 +01:00
David Rubin
9b280ab0ab
gh-116988: Remove duplicates of `annotated_rhs` in the Grammar ( #117004 )
2024-04-24 18:16:06 +01:00
Nikita Sobolev
de1f686827
gh-118082: Improve `import` without names syntax error message ( #118083 )
2024-04-23 13:00:52 +01:00
Grigoriev Semyon
c97d3af239
gh-109120: Fix syntax error in handlinh of incorrect star expressions ( #117444 )
2024-04-02 11:42:58 +01:00
Pablo Galindo Salgado
61599a48f5
bpo-24612: Improve syntax error for 'not' after an operator (GH-28170)
...
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2024-03-26 10:30:46 +01:00
Alex Waygood
7a3518e43a
gh-115881: Ensure `ast.parse()` parses conditional context managers even with low `feature_version` passed ( #115920 )
2024-02-26 09:22:09 +00:00
Grigoriev Semyon
bb4c167060
gh-111488: Changed error message in case of no 'in' keyword after 'for' in cmp ( #113656 )
2024-01-06 10:27:49 +00:00
Crowthebird
1c8f912ebd
bpo-45759: Better error messages for non-matching 'elif'/'else' statements ( #29513 )
2023-11-20 13:27:53 +00:00
Tomas R
453e96e302
gh-111420: Allow type comments in parenthesized `with` statements ( #111468 )
2023-10-31 21:02:42 +00:00
Pablo Galindo Salgado
24e4ec7766
gh-110938: Fix error messages for indented blocks with functions and classes with generic type parameters ( #110973 )
2023-10-17 13:45:13 +01:00
Pablo Galindo Salgado
3d180347ae
gh-110696: Fix incorrect syntax error message for incorrect argument unpacking ( #110706 )
2023-10-12 09:02:02 +00:00
Pablo Galindo Salgado
b28ffaa193
gh-109596: Ensure repeated rules in the grammar are not allowed and fix incorrect soft keywords ( #109606 )
2023-09-22 19:03:23 +01:00
Pablo Galindo Salgado
5bda2f637e
gh-109114: Relax the check for invalid lambdas inside f-strings to avoid false positives ( #109121 )
2023-09-08 17:00:23 +00:00
Pablo Galindo Salgado
da8f87b7ea
gh-107015: Remove async_hacks from the tokenizer ( #107018 )
2023-07-26 16:34:15 +01:00
Pablo Galindo Salgado
13237a2da8
gh-98931: Add custom error messages to invalid import/from with multiple targets ( #105985 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-22 15:56:40 +00:00
Pablo Galindo Salgado
41de54378d
gh-105194: Fix format specifier escaped characters in f-strings ( #105231 )
2023-06-02 13:33:26 +02:00
Jelle Zijlstra
ba73473f4c
gh-104799: Move location of type_params AST fields ( #104828 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-26 05:54:37 -07:00
Jelle Zijlstra
a5f244d627
gh-104656: Rename typeparams AST node to type_params ( #104657 )
2023-05-21 21:25:09 -07:00
Jelle Zijlstra
24d8b88420
gh-103763: Implement PEP 695 ( #103764 )
...
This implements PEP 695, Type Parameter Syntax. It adds support for:
- Generic functions (def func[T](): ...)
- Generic classes (class X[T](): ...)
- Type aliases (type X = ...)
- New scoping when the new syntax is used within a class body
- Compiler and interpreter changes to support the new syntax and scoping rules
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Eric Traut <eric@traut.com>
Co-authored-by: Larry Hastings <larry@hastings.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-15 20:36:23 -07:00
Lysandros Nikolaou
9169a56fad
gh-103656: Transfer f-string buffers to parser to avoid use-after-free (GH-103896)
...
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2023-04-27 01:33:31 +00:00
Pablo Galindo Salgado
1ef61cf71a
gh-102856: Initial implementation of PEP 701 ( #102855 )
...
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2023-04-19 11:18:16 -05:00
Lysandros Nikolaou
6d8da238cc
gh-90994: Improve error messages upon call arguments syntax errors (GH-96893)
2022-11-21 00:15:05 +01:00
Lysandros Nikolaou
9c4232ae89
gh-99211: Point to except/except* on syntax errors when mixing them (GH-99215)
...
Automerge-Triggered-By: GH:lysnikolaou
2022-11-20 09:11:02 -08:00
Irit Katriel
61b6c40b64
gh-99153: set location on SyntaxError for try with both except and except* (GH-99160)
2022-11-06 15:36:19 +00:00
Pablo Galindo Salgado
395d4285bf
gh-98931: Improve error message when the user types 'import x from y' instead of 'from y import x' ( #98932 )
2022-11-01 13:01:20 +00:00
Lysandros Nikolaou
7e36abbb78
gh-91210: Improve error message when non-default param follows default (GH-95933)
...
- Improve error message when parameter without a default follows one with a default
- Show same error message when positional-only params precede the default/non-default sequence
2022-09-17 10:09:28 -07:00
Nikita Sobolev
2c7d2e8d46
gh-96587: Raise `SyntaxError` for PEP654 on older `feature_version` ( #96588 )
2022-09-05 17:54:09 +01:00
Shantanu
a965db37f2
gh-94996: Disallow lambda pos only params with feature_version < (3, 8) (GH-95934)
2022-08-12 20:41:02 +02:00