Commit Graph
204 Commits
Author SHA1 Message Date
Bartosz SławeckiandGitHub 448d7b96c1 gh-145239: Accept unary plus literal pattern (#148566)
Add '+' alternatives to signed_number and signed_real_number grammar
rules, mirroring how unary minus is already handled for pattern matching.
Unary plus is a no-op on numbers so the value is returned directly without
wrapping in a UnaryOp node.
2026-04-23 22:07:28 +03:00
Stan UlbrychandGitHub e1c224624a gh-145783: Propagate errors raised in NEW_TYPE_COMMENT (#145784) 2026-03-13 11:05:20 +00:00
09e8c38231 gh-145241: specialize SyntaxError for single trailing-comma with item (#145282)
Co-authored-by: Bartosz Sławecki <[email protected]>
2026-02-28 02:24:06 +00:00
46d5106cfa gh-142349: Implement PEP 810 - Explicit lazy imports (#142351)
Co-authored-by: T. Wouters <[email protected] >
Co-authored-by: Brittany Reynoso <[email protected]>
Co-authored-by: Dino Viehland <[email protected]>
2026-02-12 00:15:33 +00:00
ccbe41e27c gh-143055: Implementation of PEP 798 (#143056)
Co-authored-by: Jelle Zijlstra <[email protected]>
2026-01-30 20:37:52 -08:00
Pablo Galindo SalgadoandGitHub c433986005 gh-142236: Improve error location for missing comma in string concatenations (#142330) 2025-12-11 14:47:26 +00:00
Victor StinnerandGitHub 7fe1a18b77 gh-130396: Remove _Py_ReachedRecursionLimitWithMargin() function (#141951)
Move the private function to the internal C API (pycore_ceval.h).
2025-11-27 12:32:00 +01:00
Brian SchubertandGitHub 3dab11f888 gh-138944: Fix SyntaxError message for invalid syntax following valid import-as statement (#138945) 2025-10-26 22:35:21 +00:00
92c0c45563 gh-138857: Improve error message for case outside of match (#138858)
* gh-138857: Improve error message for `case` outside of `match`

---------

Co-authored-by: Bartosz Sławecki <[email protected]>
2025-10-24 11:20:54 +02:00
Bartosz SławeckiandGitHub b3b0d75069 gh-140253: Improve the syntax error from an ill-positioned double-star subpattern (#140254) 2025-10-22 21:29:14 +03:00
sobolevnandGitHub cf8f36fe0a gh-138716: Fix assert a := b syntax error message (#138718) 2025-09-10 16:05:16 +03:00
sobolevnandGitHub 6bc65c30ff gh-136616: Improve assert syntax error messages (#136653) 2025-09-09 23:26:22 +03:00
Pablo Galindo SalgadoandGitHub 4e08a9f97a gh-137078: Fix keyword typo recognition when executed over files (#137079) 2025-08-15 15:14:13 +00:00
c5e77af131 gh-132661: Disallow Template/str concatenation after PEP 750 spec update (#135996)
Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Lysandros Nikolaou <[email protected]>
2025-07-21 08:44:26 +02:00
sobolevnandGitHub 7e33558455 gh-135422: Fix regression in SyntaxError messages after #134036 (#135423) 2025-06-30 21:52:26 +03:00
Bénédikt TranandGitHub 754e7c9b51 gh-133157: remove usage of _Py_NO_SANITIZE_UNDEFINED in Parser/pegen.c (#134048) 2025-06-10 01:08:30 +01:00
sobolevnandGitHub 0d9ccc87a2 gh-134036: Improve error messages for invalid raise statements (#134077) 2025-06-06 01:51:06 +01:00
Victor StinnerandGitHub 6e80f11eb5 gh-135028: Increase parser MAXSTACK for nested parenthesis (#135031) 2025-06-03 08:40:45 +02:00
sobolevnandGitHub 84914ad0e5 gh-133999: Fix except parsing regression in 3.14 (#134035) 2025-05-17 17:57:02 +03:00
Stan UlbrychandGitHub 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
sobolevnandGitHub 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
sobolevnandGitHub a6ddd078d0 gh-123539: Improve SyntaxError msg for import as with not a name (#123629) 2025-05-02 08:34:13 +00:00
sobolevnandGitHub 5cdd49b3f4 gh-133196: Guard PEP 750 grammar with CHECK_VERSION (#133225) 2025-05-01 09:17:07 +02:00
sobolevnandGitHub b1f893875b gh-133194: Add CHECK_VERSION to new PEP758 grammar (#133195) 2025-04-30 13:39:26 +03:00
+1 60202609a2 gh-132661: Implement PEP 750 (#132662)
Co-authored-by: Lysandros Nikolaou <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Wingy <[email protected]>
Co-authored-by: Koudai Aono <[email protected]>
Co-authored-by: Dave Peck <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Paul Everitt <[email protected]>
Co-authored-by: sobolevn <[email protected]>
2025-04-30 11:46:41 +02:00
Steele FarnsworthandGitHub 99b71efe8e gh-129858: Special syntax error for elif block after else (#129902) 2025-04-25 01:25:48 +00:00
bf3a0a1c0f gh-132449: Improve syntax error messages for keywords with typos (#132450)
Signed-off-by: Pablo Galindo <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
2025-04-22 11:01:55 +02:00
Pablo Galindo SalgadoandGitHub c2ac662f28 gh-131831: Implement PEP 758 – Allow except and except* expressions without parentheses (#131833) 2025-04-01 19:04:56 +00:00
Mark ShannonandGitHub 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 ViktorinandGitHub 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 ShannonandGitHub 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
bcc9a5dddb gh-129515: Clarify syntax error messages for conditional expressions (#129880)
Co-authored-by: Pablo Galindo Salgado <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
2025-02-18 21:43:19 +00:00
Pablo Galindo SalgadoandGitHub 3bd3e09588 gh-125331: Allow the parser to activate future imports on the fly (#125482) 2025-02-14 04:54:56 +00:00
Pablo Galindo SalgadoandGitHub 6fb5138776 gh-88535: Improve syntax error for wrongly closed strings (#26633) 2025-02-13 01:30:20 +00:00
Rigel Di ScalaandGitHub 39c859f6ff gh-122951: Simplify the grammar of the assignment rule (#124998) 2024-10-06 11:55:56 +02:00
efimov-mikhailandGitHub 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
sobolevnandGitHub 23f159ae71 gh-123562: Improve SyntaxError message for case ... as a.b (#123563) 2024-09-02 13:11:44 +02:00
sobolevnandGitHub e451a8937d gh-123440: Improve error message for except as used with not a name (#123442) 2024-08-30 17:21:59 +01:00
Lysandros NikolaouandGitHub 348184845a gh-120956: Avoid comparison of int to Py_ssize_t in parser (#120959) 2024-06-24 18:13:02 +02:00
Petr ViktorinandGitHub 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 ViktorinandGitHub 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 SobolevandGitHub b60d4c0d53 gh-118090: Improve error message for empty type param brackets (GH-118091) 2024-05-07 14:01:06 +02:00
ca269e58c2 gh-116126: Implement PEP 696 (#116129)
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Shantanu <[email protected]>
2024-05-03 06:17:32 -07:00
David RubinandGitHub 9b280ab0ab gh-116988: Remove duplicates of annotated_rhs in the Grammar (#117004) 2024-04-24 18:16:06 +01:00
Nikita SobolevandGitHub de1f686827 gh-118082: Improve import without names syntax error message (#118083) 2024-04-23 13:00:52 +01:00
Grigoriev SemyonandGitHub c97d3af239 gh-109120: Fix syntax error in handlinh of incorrect star expressions (#117444) 2024-04-02 11:42:58 +01:00
61599a48f5 bpo-24612: Improve syntax error for 'not' after an operator (GH-28170)
Co-authored-by: Lysandros Nikolaou <[email protected]>
2024-03-26 10:30:46 +01:00
Alex WaygoodandGitHub 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 SemyonandGitHub 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
CrowthebirdandGitHub 1c8f912ebd bpo-45759: Better error messages for non-matching 'elif'/'else' statements (#29513) 2023-11-20 13:27:53 +00:00