GeezerVison is showing github.com — gh-145241: specialize SyntaxError for single trailing-comma with item by pablogsal · Pull Request #145282 · python/cpython
Conversation
pablogsal
commented
Feb 26, 2026
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
johnslavik
left a comment
•
edited
Loading
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 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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh 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.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!
|
Sorry, something went wrong.
Uh 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.14.
🐍🍒⛏🤖
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Sorry, @pablogsal, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 09e8c382312b145b710dca7072ff2e13fe8c09ab 3.13
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Sorry, @pablogsal, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 09e8c382312b145b710dca7072ff2e13fe8c09ab 3.14
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Uhh no, not worth it maybe.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
johnslavik
commented
Feb 28, 2026
•
edited
Loading
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
ljfp
pushed a commit
to ljfp/cpython
that referenced
this pull request
Apr 25, 2026
Reviewers
lysnikolaou
Awaiting requested review from lysnikolaou
lysnikolaou is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|