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

gh-129515: Clarify syntax error messages for conditional expressions#129880

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

Conversation

@sergey-miryanov
Copy link
Contributor

@sergey-miryanovsergey-miryanov commentedFeb 9, 2025
edited
Loading

Along the suggestion from the original issue, I have added the following rules and messages:
The following expressions will be handled bya=disjunction 'if' b=disjunction 'else' c=invalid_ifexp_orelse_stmt and generate the message "Syntax Error: statement given where 'orelse' expression required" instead of just "Syntax Error: invalid syntax":

1 if True else pass1 if True else return1 if True else raise Exception('test')1 if True else del smth1 if True else yield 21 if True else assert False1 if True else break1 if True else continue

The following expressions will be handled bya=invalid_ifexp_body_stmt 'if' b=disjunction 'else' c=expression and generate the message "Syntax Error: statement given where 'body' expression required":

pass if True else 1break if True else 1continue if True else 1

The followingexpressions will be handled bya=invalid_ifexp_body_stmt 'if' b=disjunction 'else' c=invalid_ifexp_orelse_stmt and generate the message "Syntax Error: statement given where 'body' expression required":

pass if True else passbreak if True else continue

@sergey-miryanovsergey-miryanov marked this pull request as draftFebruary 9, 2025 06:55
@sergey-miryanov
Copy link
ContributorAuthor

test_fstring fails, will dig

@sergey-miryanovsergey-miryanov marked this pull request as ready for reviewFebruary 9, 2025 09:25
@sergey-miryanovsergey-miryanov marked this pull request as draftFebruary 10, 2025 18:35
@sergey-miryanovsergey-miryanov marked this pull request as ready for reviewFebruary 10, 2025 18:38
Copy link
Member

@pablogsalpablogsal left a comment

Choose a reason for hiding this comment

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

Left some new comments

@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@sergey-miryanov
Copy link
ContributorAuthor

I have made the requested changes; please review again

@bedevere-app
Copy link

Thanks for making the requested changes!

@pablogsal: please review the changes made to this pull request.

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Copy link
Member

@pablogsalpablogsal left a comment

Choose a reason for hiding this comment

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

Ah, this looks MUCH better. Really well done@sergey-miryanov! 👍

…e-129515.3L3vmo.rstCo-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@sergey-miryanov
Copy link
ContributorAuthor

Thank you all for your review! I made the suggested changes, and it is ready now.

@pablogsalpablogsal merged commitbcc9a5d intopython:mainFeb 18, 2025
42 checks passed
@pablogsal
Copy link
Member

Excellent job@sergey-miryanov!

Thanks for your contribution 👌

sergey-miryanov reacted with thumbs up emoji

@sergey-miryanov
Copy link
ContributorAuthor

Thanks!

@sergey-miryanovsergey-miryanov deleted the gh-129515-ifexp-syntax-error branchFebruary 19, 2025 12:43
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@picnixzpicnixzpicnixz left review comments

@StanFromIrelandStanFromIrelandStanFromIreland left review comments

@pablogsalpablogsalpablogsal approved these changes

@Eclips4Eclips4Awaiting requested review from Eclips4

@lysnikolaoulysnikolaouAwaiting requested review from lysnikolaoulysnikolaou is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@sergey-miryanov@picnixz@ZeroIntensity@pablogsal@StanFromIreland

[8]ページ先頭

©2009-2025 Movatter.jp