Skip to content

Commit

Permalink
Fix error codes option serialization (#13523)
Browse files Browse the repository at this point in the history
Fixes #13521
  • Loading branch information
ilevkivskyi authored and Ivan Levkivskyi committed Sep 9, 2022
1 parent 1f80611 commit 228bd29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mypy/options.py
Expand Up @@ -467,7 +467,7 @@ def select_options_affecting_cache(self) -> Mapping[str, object]:
result: Dict[str, object] = {}
for opt in OPTIONS_AFFECTING_CACHE:
val = getattr(self, opt)
if isinstance(val, set):
val = sorted(val)
if opt in ("disabled_error_codes", "enabled_error_codes"):
val = sorted([code.code for code in val])
result[opt] = val
return result
10 changes: 10 additions & 0 deletions test-data/unit/check-incremental.test
Expand Up @@ -5980,3 +5980,13 @@ foo(name='Jennifer', age="38")
[out]
[out2]
tmp/m.py:2: error: Argument "age" to "foo" has incompatible type "str"; expected "int"

[case testDisableEnableErrorCodesIncremental]
# flags: --disable-error-code truthy-bool
# flags2: --enable-error-code truthy-bool
def foo() -> int: ...
if foo:
...
[out]
[out2]
main:4: error: Function "Callable[[], int]" could always be true in boolean context

0 comments on commit 228bd29

Please sign in to comment.