gh-129515: Clarify syntax error messages for conditional expressions#129880
gh-129515: Clarify syntax error messages for conditional expressions#129880pablogsal merged 24 commits intopython:mainfrom
Conversation
|
test_fstring fails, will dig |
…y-miryanov/cpython into pythongh-129515-ifexp-syntax-error
|
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 phrase |
- also reword error messages - move tests to test_syntax - update whatsnew and news
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @pablogsal: please review the changes made to this pull request. |
Co-authored-by: Stan Ulbrych <[email protected]>
pablogsal
left a comment
There was a problem hiding this comment.
Ah, this looks MUCH better. Really well done @sergey-miryanov! 👍
Misc/NEWS.d/next/Core_and_Builtins/2025-02-09-11-30-38.gh-issue-129515.3L3vmo.rst
Outdated
Show resolved
Hide resolved
…e-129515.3L3vmo.rst Co-authored-by: Bénédikt Tran <[email protected]>
…y-miryanov/cpython into pythongh-129515-ifexp-syntax-error
|
Thank you all for your review! I made the suggested changes, and it is ready now. |
|
Excellent job @sergey-miryanov! Thanks for your contribution 👌 |
|
Thanks! |
Along the suggestion from the original issue, I have added the following rules and messages:
The following expressions will be handled by
a=disjunction 'if' b=disjunction 'else' c=invalid_ifexp_orelse_stmtand generate the message "Syntax Error: statement given where 'orelse' expression required" instead of just "Syntax Error: invalid syntax":The following expressions will be handled by
a=invalid_ifexp_body_stmt 'if' b=disjunction 'else' c=expressionand generate the message "Syntax Error: statement given where 'body' expression required":The followingexpressions will be handled by
a=invalid_ifexp_body_stmt 'if' b=disjunction 'else' c=invalid_ifexp_orelse_stmtand generate the message "Syntax Error: statement given where 'body' expression required":