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
Changes from1 commit
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
PrevPrevious commit
fixup! [3.11]gh-110696: Fix incorrect syntax error message for incor…
…rect argument unpacking (GH-110706) (cherry picked from commit3d18034)
  • Loading branch information
@pablogsal
pablogsal committedOct 13, 2023
commitf0280859056807d1f08f975860897796269d39bc
140 changes: 6 additions & 134 deletionsLib/test/test_syntax.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1827,145 +1827,17 @@ def f(x: *b)
^^^^^^^^^^^
SyntaxError: bytes can only contain ASCII literal characters

<<<<<<< HEAD
||||||| parent of 3d180347ae7 (gh-110696: Fix incorrect syntax error message for incorrect argument unpacking (#110706))
Invalid expressions in type scopes:

>>> type A[T: (x:=3)] = int
Traceback (most recent call last):
...
SyntaxError: named expression cannot be used within a TypeVar bound

>>> type A[T: (yield 3)] = int
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within a TypeVar bound

>>> type A[T: (await 3)] = int
Traceback (most recent call last):
...
SyntaxError: await expression cannot be used within a TypeVar bound

>>> type A[T: (yield from [])] = int
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within a TypeVar bound

>>> type A = (x := 3)
Traceback (most recent call last):
...
SyntaxError: named expression cannot be used within a type alias

>>> type A = (yield 3)
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within a type alias

>>> type A = (await 3)
Traceback (most recent call last):
...
SyntaxError: await expression cannot be used within a type alias

>>> type A = (yield from [])
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within a type alias

>>> class A[T]((x := 3)): ...
Traceback (most recent call last):
...
SyntaxError: named expression cannot be used within the definition of a generic

>>> class A[T]((yield 3)): ...
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within the definition of a generic

>>> class A[T]((await 3)): ...
Traceback (most recent call last):
...
SyntaxError: await expression cannot be used within the definition of a generic

>>> class A[T]((yield from [])): ...
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within the definition of a generic

=======
Invalid expressions in type scopes:

>>> type A[T: (x:=3)] = int
>>> f(**x, *y)
Traceback (most recent call last):
...
SyntaxError: named expression cannot be used within a TypeVar bound

>>> type A[T: (yield 3)] = int
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within a TypeVar bound

>>> type A[T: (await 3)] = int
Traceback (most recent call last):
...
SyntaxError: await expression cannot be used within a TypeVar bound

>>> type A[T: (yield from [])] = int
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within a TypeVar bound

>>> type A = (x := 3)
Traceback (most recent call last):
...
SyntaxError: named expression cannot be used within a type alias

>>> type A = (yield 3)
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within a type alias

>>> type A = (await 3)
Traceback (most recent call last):
...
SyntaxError: await expression cannot be used within a type alias
SyntaxError: iterable argument unpacking follows keyword argument unpacking

>>>type A = (yield from [])
>>>f(**x, *)
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within a type alias

>>> class A[T]((x := 3)): ...
Traceback (most recent call last):
...
SyntaxError: named expression cannot be used within the definition of a generic

>>> class A[T]((yield 3)): ...
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within the definition of a generic

>>> class A[T]((await 3)): ...
Traceback (most recent call last):
...
SyntaxError: await expression cannot be used within the definition of a generic
SyntaxError: iterable argument unpacking follows keyword argument unpacking

>>>class A[T]((yield from [])): ...
>>>f(x, *:)
Traceback (most recent call last):
...
SyntaxError: yield expression cannot be used within the definition of a generic

>>> 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
>>>>>>> 3d180347ae7 (gh-110696: Fix incorrect syntax error message for incorrect argument unpacking (#110706))
SyntaxError: invalid syntax
"""

import re
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp