GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-140764: Make "missed comma" syntax warning less cryptic by alonme · Pull Request #140893 · python/cpython

Conversation

@alonme

@alonme alonme commented Nov 1, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Issue: Make "perhaps you missed a comma?" hint in syntax warnings less cryptic #140764

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@alonme
Enhance syntax warning hint
a119424
@alonme
alonme requested review from iritkatriel and markshannon as code owners November 1, 2025 17:21
@bedevere-app bedevere-app Bot added the awaiting review label Nov 1, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Nov 1, 2025
Make "perhaps you missed a comma?" hint in syntax warnings less cryptic #140764
Open
@7576457

7576457 commented Nov 1, 2025

Copy link
Copy Markdown

I was just working on this :)

I was thinking of suggesting something like (as hinted):
"perhaps you missed a comma to separate sequence elements?"

1 Keep “perhaps” -> stays consistent with Python’s style.
2 Add “to separate sequence elements” -> makes it clear that it’s about lists, tuples, function arguments, etc.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland

StanFromIreland commented Nov 1, 2025

Copy link
Copy Markdown
Member

@alonme In the future, when someone says they are working on something in the issue thread, please don't open a PR.

webknjaz reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland
StanFromIreland requested a review from ncoghlan November 1, 2025 18:05
@alonme

alonme commented Nov 1, 2025

Copy link
Copy Markdown
Contributor Author

@StanFromIreland Sure, is there a rough guideline to how long after someone "claims" an issue is it okay to try and tackle it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland

StanFromIreland commented Nov 1, 2025

Copy link
Copy Markdown
Member

Sure, is there a rough guideline to how long after someone "claims" an issue is it okay to try and tackle it?

I'd recommend you wait at least three weeks, you can always ask.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blurb-it
📜🤖 Added by blurb_it.
27ee445
serhiy-storchaka
serhiy-storchaka reviewed Dec 8, 2025
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

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.

This is not only for sequence elements. You get the same warning for set and dict which are not sequences. And for function arguments.

>>> {(1, 2) (3, 4)}
<python-input-0>:1: SyntaxWarning: 'tuple' object is not callable; perhaps you missed a comma?
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    {(1, 2) (3, 4)}
     ~~~~~~~^^^^^^
TypeError: 'tuple' object is not callable
>>> print((1, 2) (3, 4))
<python-input-1>:1: SyntaxWarning: 'tuple' object is not callable; perhaps you missed a comma?
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    print((1, 2) (3, 4))
          ~~~~~~~^^^^^^
TypeError: 'tuple' object is not callable

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tadejmagajna

tadejmagajna commented Dec 21, 2025

Copy link
Copy Markdown
Contributor

Given that mentioning "sequence elements" isn't applicable to all scenarios, how about we simply make it generic and end the warning with ...; did you miss a comma to separate elements?

ncoghlan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland StanFromIreland mentioned this pull request Dec 30, 2025
gh-140764: Improve syntax warning hint for missing commas #143278
Closed
ncoghlan
ncoghlan reviewed Jan 26, 2026
View reviewed changes

@ncoghlan ncoghlan left a comment

Copy link
Copy Markdown
Contributor

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 for the PR!

Several suggestions added to tweak the wording as per the comments from @serhiy-storchaka and @tadejmagajna, along with a corresponding adjustment to the news message.

(I'm skipping setting the "request changes" flag, as folks shouldn't feel obliged to wait for a second review specifically from me once the wording has been updated)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tadejmagajna reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Lib/test/test_grammar.py Outdated
self.check_syntax_warning(test, msg)

msg=r'is not callable; perhaps you missed a comma\?'
msg=r'is not callable; did you miss a comma to separate sequence elements\?'

@ncoghlan ncoghlan Jan 26, 2026

Copy link
Copy Markdown
Contributor

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.

Suggested change
msg=r'is not callable; did you miss a comma to separate sequence elements\?'
msg=r'is not callable; did you miss a comma to separate elements\?'

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_grammar.py Outdated
check('[t"x={x}" (3, 4)]')

msg=r'is not subscriptable; perhaps you missed a comma\?'
msg=r'is not subscriptable; did you miss a comma to separate sequence elements\?'

@ncoghlan ncoghlan Jan 26, 2026

Copy link
Copy Markdown
Contributor

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.

Suggested change
msg=r'is not subscriptable; did you miss a comma to separate sequence elements\?'
msg=r'is not subscriptable; did you miss a comma to separate elements\?'

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_grammar.py Outdated
check('[t"x={x}" [i, j]]')

msg=r'indices must be integers or slices, not tuple; perhaps you missed a comma\?'
msg=r'indices must be integers or slices, not tuple; did you miss a comma to separate sequence elements\?'

@ncoghlan ncoghlan Jan 26, 2026

Copy link
Copy Markdown
Contributor

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.

Suggested change
msg=r'indices must be integers or slices, not tuple; did you miss a comma to separate sequence elements\?'
msg=r'indices must be integers or slices, not tuple; did you miss a comma to separate elements\?'

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Misc/NEWS.d/next/Core_and_Builtins/2025-12-07-10-37-32.gh-issue-140764.kABu5f.rst Outdated
@@ -0,0 +1 @@
Improve syntax warning messages for missing commas in sequences. The messages now say "did you miss a comma to separate sequence elements?" instead of "perhaps you missed a comma?".

@ncoghlan ncoghlan Jan 26, 2026

Copy link
Copy Markdown
Contributor

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.

Suggested change
Improve syntax warning messages for missing commas in sequences. The messages now say "did you miss a comma to separate sequence elements?" instead of "perhaps you missed a comma?".
Improve the suggestion in syntax warning messages for potentially missing commas when defining containers. The messages now say "did you miss a comma to separate elements?" instead of "perhaps you missed a comma?".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/codegen.c Outdated
location loc = LOC(e);
return _PyCompile_Warn(c, loc, "'%.200s' object is not callable; "
"perhaps you missed a comma?",
"did you miss a comma to separate sequence elements?",

@ncoghlan ncoghlan Jan 26, 2026

Copy link
Copy Markdown
Contributor

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.

Suggested change
"did you miss a comma to separate sequence elements?",
"did you miss a comma to separate elements?",

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/codegen.c Outdated
location loc = LOC(e);
return _PyCompile_Warn(c, loc, "'%.200s' object is not subscriptable; "
"perhaps you missed a comma?",
"did you miss a comma to separate sequence elements?",

@ncoghlan ncoghlan Jan 26, 2026

Copy link
Copy Markdown
Contributor

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.

Suggested change
"did you miss a comma to separate sequence elements?",
"did you miss a comma to separate elements?",

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/codegen.c Outdated
return _PyCompile_Warn(c, loc, "%.200s indices must be integers "
"or slices, not %.200s; "
"perhaps you missed a comma?",
"did you miss a comma to separate sequence elements?",

@ncoghlan ncoghlan Jan 26, 2026

Copy link
Copy Markdown
Contributor

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.

Suggested change
"did you miss a comma to separate sequence elements?",
"did you miss a comma to separate elements?",

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
alonme and others added 2 commits January 26, 2026 17:44
@alonme
Merge branch 'main' into enhance-syntax-warning-hint-140764
a2ad759
@alonme
Rephrase after CR
24668df
@alonme

alonme commented Jan 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @ncoghlan!
Fixed per your review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 1, 2026
@alonme
alonme requested review from ncoghlan and serhiy-storchaka May 1, 2026 15:35
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 16, 2026
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@iritkatriel iritkatriel Awaiting requested review from iritkatriel iritkatriel is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan
@serhiy-storchaka serhiy-storchaka Awaiting requested review from serhiy-storchaka

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

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.

6 participants

@alonme @7576457 @StanFromIreland @tadejmagajna @ncoghlan @serhiy-storchaka
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.