Skip to content

Conversation

codenamenam
Copy link

type: ignore comments with leading, trailing, or
repeated commas could lead to empty strings being parsed as valid
error codes.

This resulted in incorrect [unused-ignore] warnings when using the
--warn-unused-ignores flag, as the empty code '' was considered
a valid but unused ignore rule.

This commit improves the parsing logic to filter out any empty strings
that result from splitting the error codes.

fixes #20038

This comment has been minimized.

@TeamSpen210
Copy link
Contributor

Would be a nice place for a walrus operator.

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

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.

Using commas wrong in a type ignore makes there be an error code in there that is the empty string

2 participants