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
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
Serhiy Storchaka
6927632492
Remove trailing spaces (GH-31695)
2022-03-05 17:47:00 +02: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
a0efc0c196
bpo-46091: Correctly calculate indentation levels for whitespace lines with continuation characters (GH-30130)
2022-01-25 22:12:14 +00:00
Pablo Galindo Salgado
70f415fb8b
bpo-46240: Correct the error for unclosed parentheses when the tokenizer is not finished (GH-30378)
2022-01-04 10:41:22 +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
Pablo Galindo Salgado
81f4e116ef
bpo-45811: Improve error message when source code contains invisible control characters (GH-29654)
2021-11-20 18:28:28 +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
25835c518a
bpo-45738: Fix computation of error location for invalid continuation (GH-29550)
...
characters in the parser
2021-11-14 01:06:41 +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
Serhiy Storchaka
a5a56154f1
Remove trailing spaces. (GH-28706)
2021-10-03 16:58:14 +03: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
Serhiy Storchaka
a856364cc9
bpo-45229: Use doctest.DocTestSuite instead of run_doctest (GH-28468)
...
Alo use load_tests() for adding tests.
2021-09-20 11:36:57 +03:00
Carl Friedrich Bolz-Tereick
eb263f9a35
bpo-25130: Make unit-test about restricting the maximum number of nested blocks cpython-only (GH-28002)
...
PyPy and potentially other implementations have different or no
contraints on the number of blocks that can be statically nested. move
the test that checks for this behaviour into a unit test and mark it as
CPython-only.
2021-08-28 21:33:50 +03:00
Dong-hee Na
551da597a0
bpo-45000: Raise SyntaxError when try to delete __debug__ (GH-27947)
...
Automerge-Triggered-By: GH:pablogsal
2021-08-25 10:54:20 -07: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
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
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
Pablo Galindo
457ce60fc7
bpo-44368: Ensure we don't raise incorrect custom syntax errors with soft keywords (GH-26630)
2021-06-09 22:20:01 +01: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
Serhiy Storchaka
39dd141a4b
bpo-44273: Improve syntax error message for assigning to "..." (GH-26477)
...
Use "ellipsis" instead of "Ellipsis" in syntax error messages to eliminate confusion with built-in variable Ellipsis.
2021-06-01 12:07:05 +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
Batuhan Taskaya
b2ec37a722
bpo-44063: set the missing end locations on the compiler (GH-25956)
2021-05-07 20:49:06 +03: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
Pablo Galindo
56c95dfe27
bpo-43859: Improve the error message for IndentationError exceptions (GH-25431)
2021-04-21 15:28:21 +01:00
Pablo Galindo
b0544ba77c
bpo-38605: Revert making 'from __future__ import annotations' the default (GH-25490)
...
This reverts commits 044a1048ca
and 1be456ae9d
, adapting the code to changes that happened after it.
2021-04-21 12:41:19 +01:00
Pablo Galindo
b280248be8
bpo-43822: Improve syntax errors for missing commas (GH-25377)
2021-04-15 21:38:45 +01:00
Pablo Galindo
da74350174
bpo-43823: Improve syntax errors for invalid dictionary literals (GH-25378)
2021-04-15 14:06:39 +01:00
Pablo Galindo
30ed93bfec
bpo-43797: Handle correctly invalid assignments inside function calls and generators (GH-25390)
2021-04-13 17:51:21 +01:00
Pablo Galindo
d9151cb453
Ensure that early = are not matched by the parser as invalid comparisons (GH-25375)
2021-04-13 02:32:33 +01:00
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>
2021-04-12 16:59:30 +01:00
Pablo Galindo
96eeff5162
bpo-43555: Report the column offset for invalid line continuation character (GH-24939)
2021-03-22 17:28:11 +00:00
Pablo Galindo
08fb8ac99a
bpo-42128: Add 'missing :' syntax error message to match statements (GH-24733)
2021-03-18 01:03:11 +00:00
Pablo Galindo
206cbdab16
bpo-43149: Improve error message for exception group without parentheses (GH-24467)
2021-02-07 18:42:21 +00:00
Pablo Galindo
d4e6ed7e5f
bpo-43121: Fix incorrect SyntaxError message for missing comma (GH-24436)
2021-02-03 23:29:26 +00:00
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.
2021-02-02 19:54:22 +00:00
Pablo Galindo
835f14ff8e
bpo-43017: Improve error message for unparenthesised tuples in comprehensions (GH24314)
2021-01-31 22:52:56 +00:00