Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
gh-145241: specialize SyntaxError for single trailing-comma with item#145282
Conversation
3433bc5 to4994e57Compare
johnslavik left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks! I've researched this a bit more, and I think we can make this even better :-)
Sorry for the resulting back-and-forth and not enough research in the issue.
The syntax error happens every time the lastwith item (could be one or could be multiple overall) has a bare trailing comma and items aren't parenthesized.
We'd want to add cases with multiple items as well and adapt the error message accordingly. I've added suggestions ready for you to apply. Please feel free to pick better phrasing though.
PS Also suggested usingRAISE_SYNTAX_ERROR_KNOWN_LOCATION so that the caret^ points at the faulty trailing comma (right now the caret points at the colon).
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Misc/NEWS.d/next/Core_and_Builtins/2026-02-26-18-00-00.gh-issue-145241.hL2k9Q.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…e-145241.hL2k9Q.rstCo-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
09e8c38 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Thanks@pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry,@pablogsal, I could not cleanly backport this to |
Sorry,@pablogsal, I could not cleanly backport this to |
johnslavik commentedFeb 28, 2026
Uhh no, not worth it maybe. |
johnslavik commentedFeb 28, 2026 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I've requested backports because#142236 (comment), but I'm giving up on that in this case. Too much effort. |
…h item (python#145282)Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Uh oh!
There was an error while loading.Please reload this page.
with#145241