typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Disable mypy error-code overload-overlap

Open srittau opened this issue 1 year ago • 3 comments

Closes: #12178

srittau avatar Aug 01 '24 12:08 srittau

So ... is there a way to make stubtest ignore this error? (And why does stubtest even care about it?)

srittau avatar Aug 01 '24 12:08 srittau

Diff from mypy_primer, showing the effect of this PR on open source code:

mypy (https://github.com/python/mypy)
- mypy/types.py:3126: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-overload-overlap for more info

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/exception.py:51: note: In module imported here:

streamlit (https://github.com/streamlit/streamlit)
+ scripts/get_min_versions.py:20: note: In module imported here:

github-actions[bot] avatar Aug 01 '24 12:08 github-actions[bot]

So ... is there a way to make stubtest ignore this error? (And why does stubtest even care about it?)

It looks like you will need to use a custom mypy.ini or add a [tool.mypy] section to the pyproject.toml with the relevant disable_error_code setting. It might be a bit cleaner to use a common configuration file anyways, rather than manually keep the arguments in sync.

(Also I think it cares in so far, that any error code may indicate that some type information has been erased, so the stubtest output would not be testing the correct thing, it could try to be more clever and keep a list of error codes that don't ever affect the type information, but it seems like a lot of work for relatively little gain, it makes sense to me for it to expect clean mypy output with the expectation that mypy and stubtest have the same set of errors enabled through a common configuration file, so all the type information is accurate to the degree we care about)

Daverball avatar Aug 02 '24 06:08 Daverball