[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
/ cpython Public
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-15248: Emit a compiler warning when missed a comma before tuple or list. #11757

Conversation

Copy link
Member

serhiy-storchaka commented Feb 4, 2019

Copy link
Contributor

SylvainDe left a comment

This looks very cool!

As an additional comment/question: would it make sense to move the logic generating the type description from the expr_ty into a function on its own to limit duplication ? I gave it a try at https://pastebin.com/XLZ2B7Cq (not tested whatsoever).

serhiy-storchaka force-pushed the compile-warn-perhaps-missed-comma branch from ab03389 to cfe1a8d Compare Feb 5, 2019
serhiy-storchaka force-pushed the compile-warn-perhaps-missed-comma branch from cfe1a8d to 8e9dc9c Compare Feb 5, 2019
Copy link
Contributor

SylvainDe left a comment

I like this!

Copy link
Member

gvanrossum left a comment

Love this! Just some suggestions on the error messages.

Python/compile.c Outdated
case JoinedStr_kind:
case FormattedValue_kind:
return compiler_warn(c, "'%.200s' object is not callable, "
"perhaps missed a comma?",
Copy link
Member

gvanrossum Feb 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“perhaps you missed a comma?”

Also use “;” instead of “,” on the previous line.

Python/compile.c Outdated
case GeneratorExp_kind:
case Lambda_kind:
return compiler_warn(c, "'%.200s' object is not subscriptable, "
"perhaps missed a comma?",
Copy link
Member

gvanrossum Feb 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member Author

serhiy-storchaka commented Feb 16, 2019

Thank you @SylvainDe! I also thought about this type of simplification, but was hesitant. I initially implemented this idea independently, but then I seen your nice variant and borrowed it.

serhiy-storchaka merged commit 62e4481 into python:master Feb 16, 2019
serhiy-storchaka deleted the compile-warn-perhaps-missed-comma branch Feb 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants