Skip to content

Conversation

@wyattscarpenter
Copy link
Contributor

@wyattscarpenter wyattscarpenter commented May 12, 2025

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.

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

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

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

This comment has been minimized.

@github-actions

This comment has been minimized.

@wyattscarpenter wyattscarpenter marked this pull request as ready for review May 12, 2025 18:02
@github-actions

This comment has been minimized.

Copy link
Collaborator

@sterliakov sterliakov left a comment

Choose a reason for hiding this comment

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

Thanks, looks great! And the problem is rather annoying. Added one nit below.

Co-authored-by: Stanislav Terliakov <[email protected]>
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2025

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

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks!

@hauntsaninja hauntsaninja merged commit 813b4d1 into python:master Aug 2, 2025
20 checks passed
@wyattscarpenter wyattscarpenter deleted the per-m branch August 3, 2025 20:27
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.

(🐞) Invalid per-module options in inline configuration are silently ignored

3 participants