gh-145241: specialize SyntaxError for single trailing-comma with item#145282
gh-145241: specialize SyntaxError for single trailing-comma with item#145282pablogsal merged 5 commits into
Conversation
3433bc5 to
4994e57
Compare
February 26, 2026 21:46
There was a problem hiding this comment.
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 last with 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 using RAISE_SYNTAX_ERROR_KNOWN_LOCATION so that the caret ^ points at the faulty trailing comma (right now the caret points at the colon).
Sorry, something went wrong.
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
…e-145241.hL2k9Q.rst Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
09e8c38
into
python:main
Feb 28, 2026
|
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
|
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
|
Sorry, @pablogsal, I could not cleanly backport this to |
Sorry, something went wrong.
|
Sorry, @pablogsal, I could not cleanly backport this to |
Sorry, something went wrong.
|
Uhh no, not worth it maybe. |
Sorry, something went wrong.
|
I've requested backports because #142236 (comment), but I'm giving up on that in this case. Too much effort. |
Sorry, something went wrong.
…h item (python#145282) Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
…h item (python#145282) Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
with#145241