Skip to content

[mypyc] Always emit warnings#14451

Merged
JukkaL merged 1 commit intopython:masterfrom
ichard26:fix-messages-welcome-to-2023
Jan 16, 2023
Merged

[mypyc] Always emit warnings#14451
JukkaL merged 1 commit intopython:masterfrom
ichard26:fix-messages-welcome-to-2023

Conversation

@ichard26
Copy link
Copy Markdown
Collaborator

For example the warning for "treating generator comprehension as list" doesn't get printed unless there were errors too. This was due to the fact mypyc/build.py was only checking errors.num_errors to decide whether to print messages to STDOUT.

To be honest, the generate_c() logic was pretty messy, so I broke out the message printing logic into a separate helper function and made liberal use of early exits.

Fixes mypyc/mypyc#873 (comment).

For example the warning for "treating generator comprehension as list"
doesn't get printed unless there were errors too. This was due to the
fact mypyc/build.py was only checking errors.num_errors to decide
whether to print messages to STDOUT.

To be honest, the generate_c() logic was pretty messy, so I broke out
the message printing logic into a separate helper function and made
liberal use of early exits.
@ichard26 ichard26 force-pushed the fix-messages-welcome-to-2023 branch from 23bfee1 to 837e71d Compare January 15, 2023 03:13
Copy link
Copy Markdown
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Nice, hiding the warnings was confusing. As long as we don't properly support generator expressions, this is a much needed improvement.

@JukkaL JukkaL merged commit e88f4a4 into python:master Jan 16, 2023
@ichard26 ichard26 deleted the fix-messages-welcome-to-2023 branch January 16, 2023 12:06
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.

Generator expressions consumed prematurely in compiled code.

2 participants