Skip to content

Fix a bug where inline configurations of error codes would lose their values if accompanied by another inline configuration. #19075

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

wyattscarpenter
Copy link
Contributor

The following code produces a name-defined code error, despite our instructions. How can it be?!

# mypy: disable-error-code=name-defined
# mypy: strict-equality
a

The answer is, there was a bug that caused all inline configurations, even those that didn't specify any enable/disables, to overwrite the lists of enable/disables. I have now fixed that. I've also added some tests.

I discovered this problem while investigating the ultimately unrelated issue #12342 (itself of tangential interest to something else I was doing), which can now be closed.

This comment has been minimized.

This comment has been minimized.

@wyattscarpenter wyattscarpenter marked this pull request as draft May 12, 2025 04:44

This comment has been minimized.

This comment has been minimized.

@wyattscarpenter wyattscarpenter marked this pull request as ready for review May 12, 2025 18:02
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.

1 participant