Commit graph

190 commits

Author SHA1 Message Date
sobolevn
7e33558455
gh-135422: Fix regression in SyntaxError messages after #134036 (#135423) 2025-06-30 21:52:26 +03:00
Bénédikt Tran
754e7c9b51
gh-133157: remove usage of _Py_NO_SANITIZE_UNDEFINED in Parser/pegen.c (#134048)
Some checks are pending
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
Tests / (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
2025-06-10 01:08:30 +01:00
sobolevn
0d9ccc87a2
gh-134036: Improve error messages for invalid raise statements (#134077) 2025-06-06 01:51:06 +01:00
Victor Stinner
6e80f11eb5
gh-135028: Increase parser MAXSTACK for nested parenthesis (#135031) 2025-06-03 08:40:45 +02:00
sobolevn
84914ad0e5
gh-133999: Fix except parsing regression in 3.14 (#134035) 2025-05-17 17:57:02 +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
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
Mark Shannon
014223649c
GH-130396: Use computed stack limits on linux (GH-130398)
* Implement C recursion protection with limit pointers for Linux, MacOS and Windows

* Remove calls to PyOS_CheckStack

* Add stack protection to parser

* Make tests more robust to low stacks

* Improve error messages for stack overflow
2025-02-25 09:24:48 +00:00
Petr Viktorin
ef29104f7d
GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now (GH130413)
Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now

Unfortunatlely, the change broke some buildbots.

This reverts commit 2498c22fa0.
2025-02-24 11:16:08 +01:00
Mark Shannon
2498c22fa0
GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)
* Implement C recursion protection with limit pointers

* Remove calls to PyOS_CheckStack

* Add stack protection to parser

* Make tests more robust to low stacks

* Improve error messages for stack overflow
2025-02-19 11:44:57 +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
efimov-mikhail
1f9025a4e7
gh-124889: Remove redundant artificial rules in PEG parser (#124893)
Cache in C PEG-generator reworked:
we save artificial rules in cache by Node string representation as a key instead of Node object itself.
As a result total count of artificial rules in parsers.c is lowered from 283 to 170.
More natural number ordering is used for the names of artificial rules.

Auxiliary method CCallMakerVisitor._generate_artificial_rule_call is added.
Its purpose is abstracting work with artificial rules cache.

Explicit using of "is_repeat1" kwarg is added to visit_Repeat0 and visit_Repeat1 methods.
Its slightly improve code readabitily.
2024-10-03 13:58:56 +01: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
Lysandros Nikolaou
348184845a
gh-120956: Avoid comparison of int to Py_ssize_t in parser (#120959) 2024-06-24 18:13:02 +02: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
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
Brett Cannon
56e59a49ae
GH-111807: Lower the parser stack depth under WASI debug builds (#112225) 2023-11-20 13:27:33 +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
Dennis Sweeney
86617518c4
gh-108179: Add error message for parser stack overflows (#108256) 2023-08-22 08:41:50 +01: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