8000 gh-123562: Improve `SyntaxError` message for `case ... as a.b` by sobolevn · Pull Request #123563 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-123562: Improve SyntaxError message for case ... as a.b #123563

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 2, 2024

Conversation

sobolevn
Copy link
Member
@sobolevn sobolevn commented Sep 1, 2024

Notice that there's still a case that is not reported very well, but it is a rather hard one:

>>> match 1:
...     case x as a + 1: ...
...     
  File "<python-input-0>", line 2
    case x as a + 1: ...
                ^
SyntaxError: invalid syntax

This happens because pattern_capture_target actually matches case x as a but not + 1

Copy link
Contributor
@cfbolz cfbolz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member
@lysnikolaou lysnikolaou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @sobolevn!

@lysnikolaou lysnikolaou merged commit 23f159a into python:main Sep 2, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0