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
Shantanu
b5e3ea2862
gh-94996: Disallow parsing pos only params with feature_version < (3, 8) (GH-94997)
2022-08-12 19:27:50 +02:00
Shantanu
0daba82221
gh-94949: Disallow parsing parenthesised ctx mgr with old feature_version ( #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>
2022-07-18 22:10:49 +01:00
Shantanu
ae0be5a53b
gh-94947: Disallow parsing walrus with feature_version < (3, 8) ( #94948 )
...
* 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>
2022-07-18 10:20:12 +01:00
wookie184
8c237a7a71
gh-94192: Fix error for dictionary literals with invalid expression as value. ( #94304 )
...
* Fix error for dictionary literals with invalid expression as value.
* Remove trailing whitespace
2022-06-26 19:42:47 +01:00
wookie184
2fc83ac3af
gh-92858: Improve error message for some suites with syntax error before ':' ( #92894 )
2022-06-23 17:31:09 +01:00
Pablo Galindo Salgado
53a8b17895
gh-93671: Avoid exponential backtracking in deeply nested sequence patterns in match statements (GH-93680)
...
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-06-10 17:56:45 +02:00
Victor Stinner
5115a16831
gh-93103: Parser uses PyConfig.parser_debug instead of Py_DebugFlag ( #93106 )
...
* Replace deprecated Py_DebugFlag with PyConfig.parser_debug in the
parser.
* Add Parser.debug member.
* Add tok_state.debug member.
* Py_FrozenMain(): Replace Py_VerboseFlag with PyConfig.verbose.
2022-05-24 22:35:08 +02:00
Christian Heimes
137fd3d88a
gh-90473: Decrease recursion limit and skip tests on WASI (GH-92803)
2022-05-19 12:43:16 +02:00
Matthieu Dartiailh
aa0f056a00
bpo-47212: Improve error messages for un-parenthesized generator expressions (GH-32302)
2022-04-05 14:47:13 +01:00
Matthew Rahtz
e8e737bcf6
bpo-43224: Implement PEP 646 grammar changes (GH-31018)
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-26 09:55:35 -07:00
Pablo Galindo Salgado
7d810b6a4e
bpo-46838: Syntax error improvements for function definitions (GH-31590)
2022-03-22 11:38:41 +00:00
Pablo Galindo Salgado
390459de6d
Allow the parser to avoid nested processing of invalid rules (GH-31252)
2022-02-10 13:12:14 +00:00
Pablo Galindo Salgado
b71dc71905
bpo-46707: Avoid potential exponential backtracking in some syntax errors (GH-31241)
2022-02-10 03:37:17 +00:00
Pablo Galindo Salgado
dd6c35761a
bpo-46110: Restore commit e9898bf153
...
This restores commit e9898bf153
.
2022-01-03 19:54:06 +00:00
Pablo Galindo Salgado
9d35dedc5e
Revert "bpo-46110: Add a recursion check to avoid stack overflow in the PEG parser (GH-30177)" (GH-30363)
...
This reverts commit e9898bf153
temporarily as we want to confirm if this commit is the cause of a slowdown at startup time.
2022-01-03 18:29:18 +00:00
Pablo Galindo Salgado
e9898bf153
bpo-46110: Add a recursion check to avoid stack overflow in the PEG parser (GH-30177)
...
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2021-12-20 15:43:26 +00:00
Irit Katriel
d60457a667
bpo-45292: [PEP-654] add except* (GH-29581)
2021-12-14 16:48:15 +00:00
Victor Stinner
253b7a0a9f
bpo-45866: pegen strips directory of "generated from" header (GH-29777)
...
"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-26 11:50:34 +01:00
Pablo Galindo Salgado
24c10d2943
bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses (GH-29757)
2021-11-24 22:21:23 +00:00
Pablo Galindo Salgado
7a1d932528
bpo-45450: Improve syntax error for parenthesized arguments (GH-28906)
2021-11-20 18:27:40 +00:00
Pablo Galindo Salgado
546cefcda7
bpo-45727: Make the syntax error for missing comma more consistent (GH-29427)
2021-11-19 23:11:57 +00:00
Carl Friedrich Bolz-Tereick
2819e98d10
bpo-45764: improve error message when missing '(' after 'def' (GH-29484)
...
to achieve this, change the grammar to expect the '(' token after 'def' NAME.
Automerge-Triggered-By: GH:pablogsal
2021-11-09 06:03:32 -08:00
Pablo Galindo Salgado
e2d65630f3
bpo-45716: Improve the error message when using True/False/None as keywords in a call (GH-29413)
2021-11-05 13:54:55 +00:00
wim glenn
762173c670
bpo-44257: fix "assigment_expr" typo + regenerate the grammar, and remove unused imports (GH-29393)
...
Co-authored-by: Wim Glenn <wglenn@jumptrading.com>
2021-11-03 20:57:40 +00:00
Pablo Galindo Salgado
a106343f63
bpo-45494: Fix parser crash when reporting errors involving invalid 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-10-19 21:24:12 +02:00
Pablo Galindo Salgado
e5f13ce5b4
bpo-43914: Correctly highlight SyntaxError exceptions for invalid generator expression in function calls (GH-28576)
2021-09-27 14:37:43 +01:00
Pablo Galindo Salgado
b01fd533fe
Extract visitors from the grammar nodes and call makers in the peg generator (GH-28172)
...
Simplify the peg generator logic by extracting as much visitors as possible to disentangle the flow and separate concerns.
2021-09-05 14:58:52 +01:00
Pablo Galindo Salgado
b2f68b1900
bpo-44947: Refine the syntax error for trailing commas in import statements (GH-27814)
2021-08-18 22:09:21 +02:00
Pablo Galindo Salgado
953d27261e
Update pegen to use the latest upstream developments (GH-27586)
2021-08-12 17:37:30 +01:00
Pablo Galindo Salgado
f5cbea6b1b
bpo-44838: Refine the custom syntax errors for invalid 'if' expressions (GH-27615)
2021-08-05 18:28:57 +01:00
Miguel Brito
28b6dc9dd5
bpo-44792: Improve syntax errors for if expressions (GH-27506)
2021-08-02 18:11:37 +01:00
Pablo Galindo Salgado
208a7e957b
bpo-34013: Don't consider a grouped expression when reporting legacy print syntax errors (GH-27521)
2021-08-01 02:10:50 +01:00
Pablo Galindo Salgado
302cf35505
Divide the grammar into sections to improve readability (GH-27502)
2021-07-31 13:04:37 +01:00
Pablo Galindo Salgado
ecc3c8e421
bpo-34013: Move the Python 2 hints from the exception constructor to the parser (GH-27392)
2021-07-27 21:30:32 +01:00
Pablo Galindo Salgado
6948964ecf
bpo-34013: Generalize the invalid legacy statement error message (GH-27389)
2021-07-27 17:19:22 +01:00
Pablo Galindo Salgado
a283ef116b
Remove unnecessary 'invalid_primary' rule in the parser (GH-27186)
2021-07-16 13:20:09 +01:00
Pablo Galindo
0acc258fe6
bpo-44456: Improve the syntax error when mixing keyword and positional patterns (GH-26793)
2021-06-24 16:09:57 +01:00
Pablo Galindo
05073036dc
bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632)
2021-06-10 23:50:32 +01:00
Lysandros Nikolaou
e7b4644607
bpo-44385: Remove unused grammar rules (GH-26655)
...
Automerge-Triggered-By: GH:lysnikolaou
2021-06-10 15:05:06 -07:00
Akira Nonaka
aef1b58dc8
bpo-44345: Fix 'generated by' comment in parser.c (GH-26615)
2021-06-09 16:38:53 +02:00
Pablo Galindo
b250f89bb7
bpo-44305: Improve syntax error for try blocks without except or finally (GH-26523)
2021-06-03 23:52:12 +01:00
Pablo Galindo
c878a97968
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.
2021-05-21 18:34:54 +01:00
Pablo Galindo
33c0c90dea
bpo-44168: Fix error message in the parser for keyword arguments for invalid expressions (GH-26210)
2021-05-19 19:03:04 +01:00
Pablo Galindo
6692dc1ca9
bpo-43149: Correct the syntax error message for multiple exception types (GH-25996)
...
Automerge-Triggered-By: GH:pablogsal
2021-05-08 11:24:41 -07:00
Brandt Bucher
dbe60ee09d
bpo-43892: Validate the first term of complex literal value patterns (GH-25735)
2021-04-29 17:19:28 -07:00
Nick Coghlan
1e7b858575
bpo-43892: Make match patterns explicit in the AST (GH-25585)
...
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2021-04-28 22:58:44 -07:00
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
2021-04-23 14:27:05 +01:00