You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(🐞) Invalid per-module options in inline configuration are silently ignored #12342
> mypy test.py
pyproject.toml: [module = "test"]: Per-module sections should only specify per-module flags (disable_error_code, python_version)
test.py:3:1: error: Name "a" is not defined [name-defined]
Found 1 error in 1 file (checked 1 source file)
This is inconsistent with having a invalid option inline:
changed the title [-](🐞) `disable-error-code` doesn't work in inline configuration[/-][+](🐞) Invalid per-module options in inline configuration are silently ignored[/+]on Mar 21, 2022
# mypy: AMONGUS
# mypy: disable-error-code=name-defined python-verion="3.6"
# mypy: disable-error-code=name-defined
# mypy: python-verion="3.6"
a # error: Name "a" is not defined [name-defined]
gets
main.py:1: error: Unrecognized option: amongus = True [misc]
main.py:2: error: disable_error_code: Invalid error code(s): name-defined python-verion=3.6 [misc]
main.py:4: error: Unrecognized option: python_verion = 3.6 [misc]
main.py:6: error: Name "a" is not defined [name-defined]
Found 4 errors in 1 file (checked 1 source file)
Note that there is no error for line 3, even though it doesn't work!
# mypy: disable_error_code=name-defined will actually disable that error code.
This github issue was unrelated issue to what I discovered, and this can be closed as complete, as python_version now gets an Unrecognized option error when used per-module.
Activity
[-](🐞) `disable-error-code` doesn't work in inline configuration[/-][+](🐞) Invalid per-module options in inline configuration are silently ignored[/+]wyattscarpenter commentedon May 11, 2025
This is half-fixed by now, in that
gets
Note that there is no error for line 3, even though it doesn't work!
# mypy: disable_error_code=name-definedwill actually disable that error code.wyattscarpenter commentedon May 12, 2025
Oh, looks like the new incorrect behavior is actually much simpler than I thought
works. (no output)
doesn't. (output:
)
wyattscarpenter commentedon May 12, 2025
This github issue was unrelated issue to what I discovered, and this can be closed as complete, as python_version now gets an Unrecognized option error when used per-module.
Fix a bug where inline configurations of error codes would lose their…