Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.11] gh-110696: Fix incorrect syntax error message for incorrect argument unpacking (GH-110706)#110766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pablogsal merged 2 commits intopython:3.11frompablogsal:backport-3d18034-3.11
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletionGrammar/python.gram
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1075,7 +1075,8 @@ func_type_comment[Token*]:

# From here on, there are rules for invalid syntax with specialised error messages
invalid_arguments:
| a=args ',' '*' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "iterable argument unpacking follows keyword argument unpacking") }
| ((','.(starred_expression | ( assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' b='*' {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(b, "iterable argument unpacking follows keyword argument unpacking") }
| a=expression b=for_if_clauses ',' [args | expression for_if_clauses] {
RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, _PyPegen_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), "Generator expression must be parenthesized") }
| a=NAME b='=' expression for_if_clauses {
Expand Down
11 changes: 11 additions & 0 deletionsLib/test/test_syntax.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1827,6 +1827,17 @@ def f(x: *b)
^^^^^^^^^^^
SyntaxError: bytes can only contain ASCII literal characters

>>> f(**x, *y)
Traceback (most recent call last):
SyntaxError: iterable argument unpacking follows keyword argument unpacking

>>> f(**x, *)
Traceback (most recent call last):
SyntaxError: iterable argument unpacking follows keyword argument unpacking

>>> f(x, *:)
Traceback (most recent call last):
SyntaxError: invalid syntax
"""

import re
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
Fix incorrect error message for invalid argument unpacking. Patch by Pablo
Galindo
Loading

[8]ページ先頭

©2009-2025 Movatter.jp